Closed (fixed)
Project:
Webform
Version:
6.x-2.9
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Apr 2009 at 13:58 UTC
Updated:
3 Apr 2010 at 08:29 UTC
Users are complaining that Excel 2008 (Mac) and 2007 (PC) cannot simply open CSV files exported by 2.6. Doing this causes Excel to think all of the data is part of the first column.
The workaround is to use File->Import and then tell it to use the correct delimiters, but this is cumbersome.
Why is the UTF-8 BOF being prepended to CSV files, anyway? If I use this patch, things work as expected:
--- webform/.svn/text-base/webform_export.inc.svn-base 2009-02-26 16:45:45.0000
00000 -0500
+++ webform/webform_export.inc 2009-04-13 09:54:41.000000000 -0400
@@ -106,11 +106,11 @@ class webform_exporter_delimited extends
function bof(&$file_handle) {
$output = '';
// Include at BOM at the beginning of the file for Little Endian.
// This makes tab-separated imports work correctly in MS Excel.
- if (function_exists('mb_convert_encoding')) {
+ if (function_exists('mb_convert_encoding') && $this->delimiter == '\t') {
$output = chr(255) . chr(254);
}
@fwrite($file_handle, $output);
}
Comments
Comment #1
amir simantov commentedsubscribing
Comment #2
quicksketchThanks Gribnif, I finally got around to testing this and it definitely fixes problems with CSV downloads. I've committed to all branches.
Comment #4
roball commentedI don't understand how this could work since
'\t'actually had to be"\t"(see #751670: Encoding problems with non-latin language when exporting results as Excel file).Comment #5
heine commentedFF FE is not a UTF-8 Byte Order Mark, but the UTF-16 Byte Order Mark (Little Endian).
Comment #6
heine commented