CSV product reports can contain currency symbols such as £ which are output in UTF-8, but Excel interprets CSV files as being in ISO-8859-1 without using the text import wizard. This patch adds the UTF-8 byte order mark to the start of each CSV file so Excel will display their contents correctly.

CommentFileSizeAuthor
uc_reports-utf8-bom.patch737 byteslongwave

Comments

rszrama’s picture

Had to turn to Wikipedia to grok the byte order mark. Thanks for putting this together!

When I ran the export and looked at it in TextEdit, everything looked normal... but when I loaded it in Excel, I could see a character representation of the BOM (even though admittedly it shouldn't show up). I'm on a MacBook running Office 2008. Any thoughts on how to make that disappear?

longwave’s picture

Status: Needs review » Needs work

I didn't realise this would cause problems for other software when I wrote this patch! Searching Google for "utf-8 excel csv" suggests this is a common problem with no good solution; it works in certain versions of Excel (the Windows version used by my client at least) but then causes problems in other versions. Google's solution is to provide a separate CSV format for Excel, which is actually tab-separated UTF-16LE. If the PHP iconv or mbstring extensions are installed there are two better solutions listed at http://php.net/manual/en/ref.mbstring.php which might be of use.

Marking as "needs work" for now, I don't have more time to work on this at the moment.

longwave’s picture

Status: Needs work » Closed (won't fix)