Stripping accents from characters as they pass through a stream and then written to file

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

 



Hi folks,

As the subject states I am trying to convert accented characters to
their ASCII equivalents as they pass through a stream and then get
written to file by the called script but am not having any luck.  Here
is my code:

main.php
--------------
$descriptors = array(
   0 => array("pipe", "r"),
   1 => array("pipe", "w")
);

// Create connection
$process = proc_open("php script.php", $descriptors, $pipes);

// Attach filter
stream_filter_append($pipes[0], 'convert.iconv.UTF-8/ASCII//TRANSLIT');

fwrite($pipes[0], "é");

... close stuff, etc ...


script.php
--------------
$fd = fopen('log.txt', "ab");   // I've tried with and without the binary switch
$in = fopen("php://stdin", "r");
while (!feof($in)) {
    $line = fgets($in);
    fwrite($fd, $line);
}	
... close stuff, etc ...

And the character in my log file is a question mark (?).  The 2 php
files are encoded as UTF-8 and according to Notepad++ the log.txt file
is encoded in ANSI.  Any thoughts?

Marc

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[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