Hi, i am using SMW 1.8 and when I export data that contains an umlaut (ä,ö,ü,..) as CSV and open this file in Excel directly, then these characters are not displayed correctly. Instead I see things like "ÄÖÜäöüß". Is UTF8 support broken for SMW 1.8?
Heiya Basil, I suspect that the problem is not SMW but Excel. Even though you export the file in UTF-8 Excel opens the file in Latin. What does e.g. Libre office do with the same file? Cheers
I've run into the same issue as well and have a patch which at least fixes it for me. I see that SMW exports the data as UTF-8, but Excel can't figure that out, and it's a bit of a hassle to import the data in the correct format. The solution to this is to add the UTF-8 byte order mark to the beginning of the string to be returned (see http://roosmaa.net/importing-utf-8-csvs-in-excel/). Also setting the delimiter to a semicolon makes Excel happy.
What I've done is add the BOM around line 106 of includes/queryprinters/SMW_QP_CSV.php:
$result .= stream_get_contents( $csv ); // Add the UTF-8 byte order mark (BOM) so that Excel can read this in as UTF-8 $result = chr(239) . chr(187) . chr(191) . $result;
I have the same problem with Excel 2013. Adding the line
$result = chr(239) . chr(187) . chr(191) . $result;
doesn't help. Has anyone an idea how to open the csv-file in Excel with the right character set?
Instead of hacking SMW core it will be more advisable to change settings in Excel. I thing this should do the trick: [1] (German only :( ). Supposedly newer versions should have similar settings, too. LibreOffice is much nicer in this respect since it politely asks upon import which charset to use.
There is also an new excel format. This may be an alternative too.
[1] http://www.rechtsmedizin.med.uni-muenchen.de/service/anleitungen_hilfe/excel_csv_utf8/index.html