gtd / csv_builder

CSV template handler for Rails 3
MIT License
82 stars 35 forks source link

iconv conversion #12

Open ramigg opened 12 years ago

ramigg commented 12 years ago

Ruby 1.9.3 Rails 3.2.6 I need to produce output in UTF-16LE encoding.

It was not enough to supply @input_encoding = 'UTF-8' and @output_encoding = 'UTF-16LE' as it caused exception (from csv):

incompatible character encodings: UTF-16LE and US-ASCII

I had also supply :encoding => 'UTF-16LE' as part of @csv_options

gtd commented 12 years ago

I'm sorry I haven't had a chance to look at this yet. If you can supply a patch I can review it and get it in sooner than later.

johnnyshields commented 11 years ago

I'm having a similar problem. I could do this by adding in a byte-order mark (bom) which I write as the first line in the CSV file. Can't get it to work in streaming mode. Any help would be appreciated.

https://gist.github.com/johnnyshields/5618928

johnnyshields commented 11 years ago

@gtd, please see my fork https://github.com/johnnyshields/csv_builder for a bom implementation + specs for non-streaming only (spec for streaming is commented-out). Can't figure out how to add a bom in streaming...

johnnyshields commented 3 years ago

@gtd this issue has been open for 7 years but it still affects us I believe. We're still using the fork mentioned above.