I`ve have data.csv file, that must be uploaded to server , parsed ....
This file can have different encodings. I must detect it and convert to utf8.
At this moment php function mb_detect_encoding always return utf8. i tryed:
<?php
mb_detect_encoding(file_get_contents($_FILES["csv_uploadfile"]["tmp_name"]));
or
<?php
mb_detect_encoding(file_get_contents($saved_file_path));
mb_detect_encoding returns utf8.
if i use bash command
$ file -bi csv_import_1378376486.csv |awk -F "=" '{print $2}'
it rerurns iso-8859-1
so when i try
iconv --from-code=iso-8859-1 --to-code=utf-8 csv_import_1378382527.csv
it is not readable.
The real encoding is cp1251, by i cann`t detect it. Can anyone help me to solve this problem?