zdavatz / spreadsheet

The Ruby Spreadsheet by ywesee GmbH
http://spreadsheet.ch
GNU General Public License v3.0
1.13k stars 240 forks source link

Erroneously using of Codepage 21010 for UTF-16LE #189

Closed sintro closed 7 years ago

sintro commented 7 years ago

According to this information: http://www.rit.edu/drupal/api/drupal/sites!all!modules!loft_data_grids!vendor!phpoffice!phpexcel!Classes!PHPExcel!Shared!CodePage.php/function/PHPExcel_Shared_CodePage%3A%3ANumberToName/7.43 The codepage 21010 for UTF-16LE is not correct, and it should be 1200. The problem is this PR https://github.com/zdavatz/spreadsheet/pull/161 just added 21010 for UTF-16LE to the end of Codepages hash, and when one will try to save the document in UTF-16LE, it will be saved with codepage set to 21010. I already have problems with this, as many PHP Excel readers will not read such documents.

The possible solve is to at least give some API to set encoding not only by string name of it, but also by forced integer value, so if anyone (like me) have problems with 21010, he will be able to set is somehow to 1200.

PS I really think that 1200 is more correct value for UTF-16LE, and it should be in the end of the Codepages hash here https://github.com/zdavatz/spreadsheet/blob/master/lib/spreadsheet/excel/internals.rb#L53 at least

zdavatz commented 7 years ago

Ok, can you send me a Pull-Request?