Re: Problem changing file encoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 22 Oct 2008 at 14:39, Thodoris wrote:

Hi guys,
I am developing a project and I wrote an interface to import contracts in it. The problem is that when the user uploads the file I don't know what is the encoding it has. So I decided that a good idea is to make the user tell me the encoding from a drop down before I parse the file.

Then I could probably change the encoding with iconv and use it to validate the data and make the inserts in mysql. Although in the unix world I have available the iconv command and I can change the file to the new encoding like this:

iconv -f  CP737 -t UTF-8 -o newfile.csv original_file.csv

I can't find a way to do this from within php. Iconv support gives me some options but only to convert strings and there is not a way AFAIK to get all the supported encodings from the system as I can do in command line with this:

iconv --list

Is this the best way to do this ? Can I use mbstring as an alternative ?

Please make any suggestions you might think because I am stuck.

Hi,

I assume there is a reason why can't just run the command above from php?
Regards

Ian

You mean besides the fact that I have to wrap "iconv --list" output and put it in a drop down? =-O

As a matter of fact the reason is that I don't know if the server that I plan to upload the project gives me the right to run it although my linux does.

--
Thodoris


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux