CMS MADE SIMPLE FORGE

Form Browser

 

[#3308] Excel encoding (solution)

avatar
Created By: Cezary Nowak (korpirkor)
Date Submitted: Tue Apr 14 16:10:14 -0400 2009

Assigned To:
Version: None
CMSMS Version: None
Severity: None
Resolution: None
State: Open
Summary:
Excel encoding (solution)
Detailed Description:
In plain english there is no problem, but when you use language with special
characters like Ą,Ę,Ó,Ł,Ź,Ż, then after export to XLS Excel display wrong those
chars.

To repair that i did this:
FormBrowser\classes\Browser.class.php
function BrowserShowListXLS(&$mod_ptr,&$params)
return $outstr -> return iconv("UTF-8","windows-1250",$outstr);


History

Comments
avatar
Date: 2011-04-01 13:05
Posted By: Erika H. (cesarielle)

Hi,
You can also try this to fix the problem :

return iconv("UTF-8", "UNICODE",$outstr);

in the same line that said Cezary Nowak
FormBrowser\classes\Browser.class.php
function BrowserShowListXLS(&$mod_ptr,&$params)
return $outstr;
==> return iconv("UTF-8", "UNICODE",$outstr);

      
avatar
Date: 2018-10-04 03:55
Posted By: Levin G. (slick)

I have the same issue, but this solution breaks export for me in FormBrowser 0.5

A fix would be much appreciated :)
      
avatar
Date: 2018-10-04 11:44
Posted By: Georg Busch (nan)

The problem is, that Excel will only accept utf-encoded csv data as utf-8 if
there is a BOM (byte order mark). Otherwise it will be interpreted as
iso-8859-1.

Solution is to add such a BOM to the output.

File /modules/FormBrowser/action.admin_export_xls.php Line 65:

if($encoding = 'utf-8') $reportString = utf8_encode($reportString);

change it to

if($encoding = 'utf-8') $reportString = chr(0xEF).chr(0xBB).chr(0xBF) .
utf8_encode($reportString);

So Excel should interpret your csv correctly by default.