Skip to content
Advertisement

PHP encoding Umlauts in .csv for Excel

I’m working on a PHP script that creates a .csv file from some data.

Unfortunately, in Excel Umlauts are not displayed properly: Löl becomes L√∂l (this is just in Excel, in Apple’s Numbers, Atom and Textedit everything looks fine).

I have tried hundreds of functions to try and get the encoding right (see the commented functions below). Could someone please tell me what I’m doing wrong?

JavaScript

Advertisement

Answer

The following conversion to UTF-8 BOM worked:

JavaScript

Thanks for everybody who chimed in 🙂

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement