SmarterCSV and file encoding issues in Ruby
问题 I'm working with a file that appears to have UTF-16LE encoding. If I run File.read(file, :encoding => 'utf-16le') the first line of the file is: "<U+FEFF>=\"25/09/2013\"\t18:39:17\t=\"Unknown\"\t=\"+15168608203\"\t\"Message.\"\r\n If I read the file using something like csv_text = File.read(file, :encoding => 'utf-16le') I get an error stating ASCII incompatible encoding needs binmode (ArgumentError) If I switch the encoding in the above to csv_text = File.read(file, :encoding => 'utf-8') I