From: "Tanel Tammik" on
Hi,

does anyone know how to convert all files in a directory and in it's
subdirectories into utf8 encoding? i am using komodo edit as text-editor.
may it has a feature which i cannot find...

Br
Tanel


From: "Tanel Tammik" on
OP win xp pro


""Tanel Tammik"" <keevitaja(a)gmail.com> wrote in message
news:91.07.07323.BE0280C4(a)pb1.pair.com...
> Hi,
>
> does anyone know how to convert all files in a directory and in it's
> subdirectories into utf8 encoding? i am using komodo edit as text-editor.
> may it has a feature which i cannot find...
>
> Br
> Tanel
>


From: Ashley Sheridan on
On Fri, 2010-06-04 at 00:38 +0300, Tanel Tammik wrote:

> OP win xp pro
>
>
> ""Tanel Tammik"" <keevitaja(a)gmail.com> wrote in message
> news:91.07.07323.BE0280C4(a)pb1.pair.com...
> > Hi,
> >
> > does anyone know how to convert all files in a directory and in it's
> > subdirectories into utf8 encoding? i am using komodo edit as text-editor.
> > may it has a feature which i cannot find...
> >
> > Br
> > Tanel
> >
>
>
>


Could you not just open them all and save them again as utf8 files? Even
notepad can save to utf8.



Thanks,
Ash
http://www.ashleysheridan.co.uk


From: "Tanel Tammik" on

"Ashley Sheridan" <ash(a)ashleysheridan.co.uk> wrote in message
news:1275607105.2217.31.camel(a)localhost...
> On Fri, 2010-06-04 at 00:38 +0300, Tanel Tammik wrote:
>
>> OP win xp pro
>>
>>
>> ""Tanel Tammik"" <keevitaja(a)gmail.com> wrote in message
>> news:91.07.07323.BE0280C4(a)pb1.pair.com...
>> > Hi,
>> >
>> > does anyone know how to convert all files in a directory and in it's
>> > subdirectories into utf8 encoding? i am using komodo edit as
>> > text-editor.
>> > may it has a feature which i cannot find...
>> >
>> > Br
>> > Tanel
>> >
>>
>>
>>
>
>
> Could you not just open them all and save them again as utf8 files? Even
> notepad can save to utf8.
>
>
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

Isn't there a xp program for that to convert all files at once?

Tanel


From: Richard Quadling on
On 3 June 2010 22:35, Tanel Tammik <keevitaja(a)gmail.com> wrote:
> Hi,
>
> does anyone know how to convert all files in a directory and in it's
> subdirectories into utf8 encoding? i am using komodo edit as text-editor.
> may it has a feature which i cannot find...
>
> Br
> Tanel
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

What encoding are they currently set to?

iconv() [1] and mb_convert_encoding() [2] may both be up to the job.

<?php
// UNTESTED
$FilesLocation = 'C:/Work';
$FromEncoding = 'ISO-8859-1';
$ToEncoding = 'UTF-8';

foreach(new DirectoryIterator($FilesLocation) as $File) {
file_put_contents($File->getPathname(), iconv($FromEncoding,
$ToEncoding, file_get_contents($File->getPathname())));
// file_put_contents($File->getPathname(),
mb_convert_encoding(file_get_contents($File->getPathname()),
$ToEncoding, $FromEncoding));
}
?>

If the files are XML with a xml tag like ...

<?xml version="1.0" encoding="iso-8859-1" ?>

then you would have to add additional code to edit that line also.

Richard.

[1] http://docs.php.net/manual/en/function.iconv.php
[2]http://docs.php.net/manual/en/function.mb-convert-encoding.php
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling