Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change charset for CSV Export file

I'm using magento 1.7.0 in Spanish language. When export the CSV file form sales order.The Spanish character are changed. I have found the reason for that. During the export to csv the charset is set to western europe. So now i need to change that to UTF-8.

How to change that.

like image 260
MeenakshiSundaram R Avatar asked Nov 26 '13 11:11

MeenakshiSundaram R


People also ask

How do I convert a CSV file to UTF 16?

Open the file you just saved and you'll see "UTF-16 Unicode Text" as the selected option in the "File -> Save As..." dialog. If you "File -> Save" then the contents of the ". csv" file are what you'd get if you saved it as "UTF-16 Unicode Text".

What is the default encoding for CSV?

Exporting to CSV uses a default encoding of Unicode (UTF-16le).


1 Answers

Check default charset on your server (PHP, apache/nginx). If there everything looks ok, add <charset>utf8</charset> to database section in app/etc/local.xml, then default_section should looks like:

      <default_setup>
            <connection>
                <host><![CDATA[localhost]]></host>
                <username><![CDATA[root]]></username>
                <password><![CDATA[]]></password>
                <dbname><![CDATA[magento]]></dbname>
                <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                <model><![CDATA[mysql4]]></model>
                <type><![CDATA[pdo_mysql]]></type>
                <pdoType><![CDATA[]]></pdoType>
                <active>1</active>
                <charset>utf8</charset>
            </connection>
        </default_setup>

Hope it helps! Long time ago this charset tag solved some nasty encoding problems in my Magento installation :)

like image 184
kuba_ceg Avatar answered Sep 30 '22 07:09

kuba_ceg