我有somefile
我想使用的编码base64
File.open('data/somefile.edf').read.encoding
=> #<Encoding:UTF-8>
base64_string = Base64.encode64(open("data/somefile.edf").to_a.join)
然后我想解码那个文件
file = open('new_edf.edf', 'w') do |file|
file << Base64.decode64(base64_string)
end
但我收到一个错误:
Encoding::UndefinedConversionError: "\xE1" from ASCII-8BIT to UTF-8
from (pry):22:in `write'