From: Dido Sevilla Date: 2010-01-29T03:28:26+09:00 Subject: Re: gsub not working to replace a 'Chinese' Charater. On Thu, Jan 28, 2010 at 10:05 AM, Ryan Smith wrote: > gsub not works for me when replace 'DBCS'(double byte character set) > character,  using last version ruby 1.8.6 > The term 'DBCS' is not sufficient to determine what the encoding of your input character set is. That could mean any of a large number of mutually incompatible character encodings: UTF-16, Big5, Shift-JIS (for Japanese), and EUC-CN are only a few of the possibilities. Before you can even begin to process any text you get from anywhere, it's just a stream of bytes with no meaning until you know what its encoding is. You can't perform any kind of useful text processing without knowing the encoding. Once you do know the encoding, you should probably convert it to UTF-8 using the Iconv library, and you should probably be able to do something useful with the text. Also, make sure that $KCODE is 'u'. Otherwise Unicode text processing will not work. -- 普通じゃないのが当然なら答える私は何ができる? 普通でも普通じゃなくて感じるまま感じることだけをするよ! http://stormwyrm.blogspot.com