P
Pen Ttt
here is my programm
programm1:
require 'csv'
require 'iconv'
CSV.open('/home/pt/test/shbaseback.csv', 'w') do |wrow|
CSV.open('/home/pt/test/shbase.csv', 'r') do |row|
wrow << Iconv.iconv('UTF-8','GBK',row)
end
end
wrong message:
/usr/local/ruby/lib/ruby/1.9.1/csv.rb:1988:in `=~': invalid byte
sequence in UTF-8 (ArgumentError)
programm2:
require 'csv'
require 'iconv'
CSV.open('/home/pt/test/shbaseback.csv', 'w') do |wrow|
CSV.open('/home/pt/test/shbase.csv', 'r') do |row|
wrow << Iconv.iconv('UTF-8','GBK',row.to_s)
end
end
wrong message:
/usr/local/ruby/lib/ruby/1.9.1/csv.rb:1988:in `=~': invalid byte
sequence in UTF-8 (ArgumentError)
i just want to change the csvfile's (/home/pt/test/shbase.csv) code GBK
into UTF-8(/home/pt/test/shbaseback.csv),how can i do?
programm1:
require 'csv'
require 'iconv'
CSV.open('/home/pt/test/shbaseback.csv', 'w') do |wrow|
CSV.open('/home/pt/test/shbase.csv', 'r') do |row|
wrow << Iconv.iconv('UTF-8','GBK',row)
end
end
wrong message:
/usr/local/ruby/lib/ruby/1.9.1/csv.rb:1988:in `=~': invalid byte
sequence in UTF-8 (ArgumentError)
programm2:
require 'csv'
require 'iconv'
CSV.open('/home/pt/test/shbaseback.csv', 'w') do |wrow|
CSV.open('/home/pt/test/shbase.csv', 'r') do |row|
wrow << Iconv.iconv('UTF-8','GBK',row.to_s)
end
end
wrong message:
/usr/local/ruby/lib/ruby/1.9.1/csv.rb:1988:in `=~': invalid byte
sequence in UTF-8 (ArgumentError)
i just want to change the csvfile's (/home/pt/test/shbase.csv) code GBK
into UTF-8(/home/pt/test/shbaseback.csv),how can i do?