Forum: Ruby International language encoding conversion

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F12e71096774b459e8e8f61b0c289945?d=identicon&s=25 newbie (Guest)
on 2008-11-14 17:10
(Received via mailing list)
Now that Ruby 1.9.1 supports utf-8, it will be great to play with some
international languages in Ruby. But I have a question about encoding
other than utf-8. As for Chinese, some people still use gb2312 or big5
encodings. How can I make Ruby 1.9.1 recognize them, or even
automatically convert them to utf-8, if possible? Thanks a lot!
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 Yukihiro Matsumoto (Guest)
on 2008-11-15 14:33
(Received via mailing list)
Hi,

In message "Re: International language encoding conversion"
    on Sat, 15 Nov 2008 01:07:03 +0900, newbie <tao.wang.usa@gmail.com>
writes:

|Now that Ruby 1.9.1 supports utf-8, it will be great to play with some
|international languages in Ruby. But I have a question about encoding
|other than utf-8. As for Chinese, some people still use gb2312 or big5
|encodings. How can I make Ruby 1.9.1 recognize them, or even
|automatically convert them to utf-8, if possible? Thanks a lot!

Ruby 1.9.1 can handle GB2312 and Big5 encoding directly (a la Ruby 1.8
does for Japanese encoding).  But encode method does not understand
Chinese encoding yet.  So, you have to use iconv to translate them
to/from UTF-8, then force_encoding.  We welcome if someone willing to
add Big5/GB1312/GB18030 transcoding support.

              matz.
This topic is locked and can not be replied to.