how to use Chinese Characters in wxRuby?

Discussion in 'Ruby' started by yang cao, Mar 31, 2007.

  1. yang cao

    yang cao Guest

    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
     
    yang cao, Mar 31, 2007
    #1
    1. Advertisements

  2. yang cao

    Harry Guest

    T24gMy8zMS8wNywgeWFuZyBjYW8gPGNhb3lhbmdydWJ5QGdtYWlsLmNvbT4gd3JvdGU6Cj4gSSB3
    YW50IHRvIHVzZSBDaGluZXNlIGNoYXJhY3RlcnMgaW4gd3hSdWJ5LGxpa2UgdGhpczoKPiBXeDo6
    QnV0dG9uLm5ldyhAcGFuZWwsLTEsJ0NoaW5lc2UgY2hhcmFjdGVycyB3YW50ZWQgdG8gYmUgcGxh
    Y2VkJykKPiBhbHNvIGluIENoaW5lc2UgaXM6Cj4gV3g6OkJ1dHRvbi5uZXcoQHBhbmVsLC0xLCe6
    utfWJykKPgo+IGJ1dCBJIGdldCBhbiBlbXB0eSBidXR0b24uLi4KPgo+IGhvdyBjYW4gSSBkbz8K
    PiB0aGFua3MKPgo+CgpUaGlzIHdvcmtzIGZvciBtZS4KSSBjdXQgdGhpcyBvdXQgb2YgYW4gb2xk
    IHByb2dyYW0gSSB3YXMgdHJ5aW5nLgoKQnV0dG9uLm5ldyhwYW5lbCwgLTEsICLW0Ln6IiwgUG9p
    bnQubmV3KDEwLDEyNSksIFNpemUubmV3KDEwMCwyNSkpCgpIYXJyeQoKCgotLSAKCmh0dHA6Ly93
    d3cua2FrdWVraS5jb20vcnVieS9saXN0Lmh0bWwKSmFwYW5lc2UgUnVieSBMaXN0IFN1YmplY3Rz
    IGluIEVuZ2xpc2gK
     
    Harry, Mar 31, 2007
    #2
    1. Advertisements

  3. yang cao

    Alex Fenton Guest

    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
     
    Alex Fenton, Apr 2, 2007
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.