Hi guys! Need some help here.
So, I need export and import .csv files with GC and i faced with some troubles with charsets. Well, with export seems all good, just choose to output column that you need to export and
everything will be fine, default charset for exporting in GC is UTF-16LE (why so, i had read in some post on this forum for some reason that is the best choice for Window Excel)
But to save in DB i need utf-8 charset (my mysql db created with it). In common task follow -> just export from GC, then edit in Excel (or even just create there) and then for example, import back
to DB . So next questions:
1.)Is excel working with utf16le and create or save file in that charset?
2.)Or maybe change default GC export charset to UTF-8? How will that working with Excel?
Maybe just someone face with same problems and advise me what to do the best.
Workaround:
In texteditor like Notepad++ GC export UTF-16LE charset has name - UCS-2 Little Endian ( Wiki says this is the same)
In my app after importing file I try to read string by string and decode from UTF-16LE to UTF-8 with iconv('UCS-2LE / UTF-16LE', 'UTF-8', $str)
or mb_convert_encoding($str,'utf-16','utf-8'), and then using staff like str_getcsv() or similar
result is awful -> á¨€á „â€„à¤„â„€ã¸„ä„㠄㤄䄄㨄〄伄ऄ㄀ᨀഄ਀
or
[?? 09>=] => [#;8F0] => !>D89A:0O [1J5:B] => 1
And it works if I do nothing in import, just recorde file after export from GC with Notepad++, just set to UTF-8 without BOM, and then all works fine!
Any help and advise will come in handy, many thanks and have a nice day!