Re: How to detect charset encoding with PHP and command line?
| From: | Davi | Date: | Tue, 17 Apr 2007 21:33:35 +0000 |
| Subject: | Re: How to detect charset encoding with PHP and command line? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-253133@lists.php.net to get a copy of this message | ||
Em Terça 17 Abril 2007 18:18, William Lovaton escreveu:
> Any idea with this one? please??
>
> El lun, 02-04-2007 a las 07:51 -0500, William Lovaton escribió:
> > Hi there,
> >
> > I'd like to know a way to detect the file encoding from PHP and Linux
> > command line too.
> >
> > In PHP I tried mb_detect_encoding() but it doesn't work reliable, first
> > I have to specify a list of posible encodings and second it always
> > returns the first encoding I put in the list no matter what.
> >
> > Thanks for your help,
> >
> >
> > -William
You can use the file command:
davi@davi-linux ~/documentos/txt $ file mac.txt
mac.txt: ASCII text
davi@davi-linux ~/documentos/txt $ file noob.txt
noob.txt: UTF-8 Unicode text
davi@davi-linux ~/documentos/txt $ file endereços.txt
endereços.txt: ASCII text
davi@davi-linux ~/documentos/txt $ file coisas.txt
coisas.txt: UTF-8 Unicode English text
--
Davi Vidal
davividal@siscompar.com.br
davividal@gmail.com
--
Agora com fortune:
"If you see an onion ring -- answer it!"
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]