International language encoding conversion

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!

Hi,

In message “Re: International language encoding conversion”
on Sat, 15 Nov 2008 01:07:03 +0900, newbie [email protected]
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.