how to use Chinese Characters in wxRuby?

Y

yang cao

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
 
H

Harry

T24gMy8zMS8wNywgeWFuZyBjYW8gPGNhb3lhbmdydWJ5QGdtYWlsLmNvbT4gd3JvdGU6Cj4gSSB3
YW50IHRvIHVzZSBDaGluZXNlIGNoYXJhY3RlcnMgaW4gd3hSdWJ5LGxpa2UgdGhpczoKPiBXeDo6
QnV0dG9uLm5ldyhAcGFuZWwsLTEsJ0NoaW5lc2UgY2hhcmFjdGVycyB3YW50ZWQgdG8gYmUgcGxh
Y2VkJykKPiBhbHNvIGluIENoaW5lc2UgaXM6Cj4gV3g6OkJ1dHRvbi5uZXcoQHBhbmVsLC0xLCe6
utfWJykKPgo+IGJ1dCBJIGdldCBhbiBlbXB0eSBidXR0b24uLi4KPgo+IGhvdyBjYW4gSSBkbz8K
PiB0aGFua3MKPgo+CgpUaGlzIHdvcmtzIGZvciBtZS4KSSBjdXQgdGhpcyBvdXQgb2YgYW4gb2xk
IHByb2dyYW0gSSB3YXMgdHJ5aW5nLgoKQnV0dG9uLm5ldyhwYW5lbCwgLTEsICLW0Ln6IiwgUG9p
bnQubmV3KDEwLDEyNSksIFNpemUubmV3KDEwMCwyNSkpCgpIYXJyeQoKCgotLSAKCmh0dHA6Ly93
d3cua2FrdWVraS5jb20vcnVieS9saXN0Lmh0bWwKSmFwYW5lc2UgUnVieSBMaXN0IFN1YmplY3Rz
IGluIEVuZ2xpc2gK
 
A

Alex Fenton

yang said:
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

alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top