Iconv::IllegalSequence error when saving spreadsheet #17

spaghetticode opened this Issue Nov 23, 2012 · 1 comment


None yet
2 participants

spaghetticode commented Nov 23, 2012

Hello, I'm getting this error when trying to save a spreadsheet build with some external data on which I don't have the control of the character encoding.

I've noticed there is a Spreadsheet.client_encoding accessor to override the charset when reading the data, but there is none for modifying the defaults when saving.

I've made a fork with a quick and dirty fix that adds a couple of accessor for overriding the defaults, but maybe that's not the best option. Maybe changing lines 38 and 44 in lib/encodings as follows would be a good fix:

-iconv = @@iconvs[key] ||= Iconv.new('UTF-16LE', client)
+iconv = @@iconvs[key] ||= Iconv.new('UTF-16LE//TRANSLIT//IGNORE', client)

-iconv = @@iconvs[key] ||= Iconv.new('UTF-8', client)
+iconv = @@iconvs[key] ||= Iconv.new('UTF-8//TRANSLIT//IGNORE', client)

what's your opinion?


zdavatz commented Dec 1, 2012

Seems fine to me.

can you send me a pull request for this? Then I will merge into the code. Please also see if the tests still pass on Ruby 1.8 and Ruby 1.9.


@zdavatz zdavatz closed this Feb 27, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment