From: Dido Sevilla Date: 2010-01-29T03:36:20+09:00 Subject: Re: gsub not working to replace a 'Chinese' Charater. On Thu, Jan 28, 2010 at 11:13 AM, Ryan Smith wrote: > I parse a webpage which encoded in gb2312, using Watir to get the > context of the page title, and want to replace the 'chinese character' > in title with english words. > > When puts title which watir get, the chinese character displaied as > corrupt code there (under windows cmd,code page using cp936, display > works normal when change code page to utf-8).  But I think cmd's code > page just display setting does not related with what I need (replace > chinese char). I did not know if string I get by Watir is also in > 'gb2312' encoding or something others, the fact is fail happen when > convert the string to utf-8 encoding, message is complain the char is > invalid. GB2312? From a web page that probably means EUC-CN, so you have to convert from that encoding into UTF-8. -- 普通じゃないのが当然なら答える私は何ができる? 普通でも普通じゃなくて感じるまま感じることだけをするよ! http://stormwyrm.blogspot.com