From: junchen wu Date: 2009-08-20T16:43:24+09:00 Subject: [ruby-core:24990] [Bug #1965] the strange thing in Iconv under windows(GBK) Bug #1965: the strange thing in Iconv under windows(GBK) http://redmine.ruby-lang.org/issues/show/1965 Author: junchen wu Status: Open, Priority: High Target version: 1.9.1 ruby -v: ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mswin32] I have a file encoding in utf-8,this is the content: #��� config I read it and then match it with =~/ab/,it will raise: ArgumentError: invalid byte sequence in GBK. There is something strange: irb> s=IO.readlines('test.utf8').join => "#���\x89\nconfig" irb> gbk=Iconv.conv('gbk','utf-8',s) => "#���\nconfig" irb> utf=Iconv.conv('utf-8','gbk',gbk) => "#������nconfig" irb> s==utf => false # in Ruby1.8.7,it will say true irb> s=~/ab/ ArgumentError: invalid byte sequence in GBK irb> utf=~/ab/ => nil my environment: ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mswin32] Windows XP,GBK,chcp=>936 ---------------------------------------- http://redmine.ruby-lang.org