Quantcast
Viewing all articles
Browse latest Browse all 2504

PHP file encoding for french accents

Topic by Harriet Laker

Hi,

I have a script that currently encodes a csv file to UTF-8:

   // CONVERT ALL TO UTF-8
    $file = "/tmp/contact_import/data/Contact_Data_".date("dmY").".csv";
    file_put_contents($file, utf8_encode(file_get_contents($file)));
    // CONVERSION COMPLETE

I want to change this encoding to Western Europe (Windows), is there a function for this or would I just use the following:

   // CONVERT ALL TO Windows-1252
    $file = "/tmp/contact_import/data/Contact_RN_Data.csv";
    $file = mb_convert_encoding($file, 'Windows-1252');
    // CONVERSION COMPLETE

Thanks!


Viewing all articles
Browse latest Browse all 2504

Trending Articles