franklan / SpiderInRuby

SpiderInRuby
0 stars 0 forks source link

Trouble Shooting List #1

Open franklan opened 10 years ago

franklan commented 10 years ago

Encoding::UndefinedConversionError: "\xE5" from ASCII-8BIT to UTF-8

franklan commented 10 years ago

str.encode('UTF-8') if str.encoding != 'UTF-8'

改为

str = str.force_encoding('GBK')
str = str.encode('UTF-8')