Re: Problem changing file encoding
| From: | Ian | Date: | Wed, 22 Oct 2008 11:58:28 +0000 |
| Subject: | Re: Problem changing file encoding | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282244@lists.php.net to get a copy of this message | ||
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
--