Excel, iconv, and frustration
Posted: Mon Dec 15, 2008 8:30 am
So my companies website is going to go multi-lingual really soon. Since my translations are either in serialized arrays in the database or as defined constants I made a script that output everything into a nice clean excel file. This worked perfect. We got a few excel files back the other day with the new translated text and I ran them though the uploader scripts. This worked really well except for 1 problem, the encoding.
Now that is were I am now stuck. The Russian file had 0 problems, everything looks great on the website, no problems at all. The other language was Portuguese. This proved to be a problem with none of the special characters showing (just the stupid ? image on FF).
I hunted and found what I think is the problem. I have been using this: http://sourceforge.net/projects/phpexcelreader to read excel files. I have been trying to get the it to setOutputEncoding('UTF-8') instead of the setOutputEncoding('CP1251') which seams to be the default or something.
I did some tests and found out that it was not doing any sort of conversion to UTF-8 (using inconv) so I did a forceful "you will try to convert" and just got an error saying an invalid character was passed to iconv when I used the string "Key" which I found strange.
So that is where I am at. The CP1251 supports Cyrillic so thats why I am guessing the Russian looks just fine but it does not support other European characters and thats why the Portuguese sucks. I have tried everything I could think of from saving in different formats to changing the encoding of the file in Open Office and trying again but to no avail, the same thing every time. So, can anyone lend me a hand here?
Now that is were I am now stuck. The Russian file had 0 problems, everything looks great on the website, no problems at all. The other language was Portuguese. This proved to be a problem with none of the special characters showing (just the stupid ? image on FF).
I hunted and found what I think is the problem. I have been using this: http://sourceforge.net/projects/phpexcelreader to read excel files. I have been trying to get the it to setOutputEncoding('UTF-8') instead of the setOutputEncoding('CP1251') which seams to be the default or something.
I did some tests and found out that it was not doing any sort of conversion to UTF-8 (using inconv) so I did a forceful "you will try to convert" and just got an error saying an invalid character was passed to iconv when I used the string "Key" which I found strange.
So that is where I am at. The CP1251 supports Cyrillic so thats why I am guessing the Russian looks just fine but it does not support other European characters and thats why the Portuguese sucks. I have tried everything I could think of from saving in different formats to changing the encoding of the file in Open Office and trying again but to no avail, the same thing every time. So, can anyone lend me a hand here?