# How to use Chinese Characters in wxRuby?

**URL:** <https://www.ruby-forum.com/t/how-to-use-chinese-characters-in-wxruby/90732>\
**Category:** Ruby\
**Created:** [March 31, 2007, 4:13pm UTC](https://www.ruby-forum.com/t/how-to-use-chinese-characters-in-wxruby/90732 "2007-03-31T16:13:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yang\_cao](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/f6c823/32.png) [@yang\_cao](https://www.ruby-forum.com/u/yang_cao)\
**Post date:** [March 31, 2007, 4:13pm UTC](https://www.ruby-forum.com/t/how-to-use-chinese-characters-in-wxruby/90732/1 "2007-03-31T16:13:28Z")

</div>

I want to use Chinese characters in wxRuby,like this:  
Wx::Button.new(@panel,-1,‘Chinese characters wanted to be placed’)  
also in Chinese is:  
Wx::Button.new(@panel,-1,‘æ±‰å­—’)

but I get an empty button…

how can I do?  
thanks

---

<div class="post-metadata">

**Author:** ![yang\_cao](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/f6c823/32.png) [@yang\_cao](https://www.ruby-forum.com/u/yang_cao)\
**Post date:** [March 31, 2007, 5:19pm UTC](https://www.ruby-forum.com/t/how-to-use-chinese-characters-in-wxruby/90732/2 "2007-03-31T17:19:38Z")

</div>

On 3/31/07, yang cao [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

This works for me.  
I cut this out of an old program I was trying.

Button.new(panel, -1, “ÖÐ¹ú”, Point.new(10,125), Size.new(100,25))

Harry

–

[http://www.kakueki.com/ruby/list.html](http://www.kakueki.com/ruby/list.html)  
Japanese Ruby List Subjects in English

---

<div class="post-metadata">

**Author:** ![yang\_cao](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/f6c823/32.png) [@yang\_cao](https://www.ruby-forum.com/u/yang_cao)\
**Post date:** [April 2, 2007, 10:36am UTC](https://www.ruby-forum.com/t/how-to-use-chinese-characters-in-wxruby/90732/3 "2007-04-02T10:36:40Z")

</div>

yang cao wrote:

> I want to use Chinese characters in wxRuby,like this:  
> Wx::Button.new(@panel,-1,‘Chinese characters wanted to be placed’)  
> also in Chinese is:  
> Wx::Button.new(@panel,-1,‘æ±‰å­—’)

Assuming you’re using wxruby2, which you should be, ensure that your  
script is in UTF8 encoding, and that you have $KCODE = ‘u’ at the top of  
it.

Have a look at the demo samples/text/unicode.rb which demonstrates the  
use of controls with labels and content in numerous different scripts  
including Chinese.

The wxruby-users mailing list is a good place for any questions about  
the toolkit:  
[http://rubyforge.org/mail/?group\_id=35](http://rubyforge.org/mail/?group_id=35)

alex
