From: Joey Zhou Date: 2011-03-23T00:26:32+09:00 Subject: Re: How could I make the Ruby 1.9 string ignore the invalid utf-8 byte sequence in split? Maybe you should not encode the data from its external_encoding to UTF-8. I had been trapped in the encoding problem that some GBK characters cannot transform to UTF-8. # encoding: utf-8 File.open('file.txt', 'r:gbk').each_line do |line| # not 'r:gbk:utf-8' arr = line.chomp.split("\t".encode('gbk')) # encode "\t" to gbk # blah blah end Joey -- Posted via http://www.ruby-forum.com/.