Tag Archives: UTF-8

PHP – Write file in specific charset/encoding

Sometimes we need to specify the file charset before writing the data to a file. The data strings which we get from the database are in UTF-8 so we have to convert them in proper charset. This could be done be iconv().

For example, i want to write the Traditional Chinese in Big5. The conversion could be done by.
Continue reading PHP – Write file in specific charset/encoding

Advertisement

Garbled characters when opening CSV in Microsoft Excel

Quite often i will use Microsoft Excel to edit CSV file. But sometimes you may find garbled characters in the opened file and it is caused by the file encoding.

For example, Excel could not view UTF-8 file. So if you got a CSV encoded in UTF-8, you need to convert it to ANSI encoded. This could be done by opening the CSV file in Notepad and then save it as new file in ANSI encoding. Continue reading Garbled characters when opening CSV in Microsoft Excel