correct character decoding

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

 



Hi there,

I am trying to find a solution for decoding the same string from 2 different character sets (UTF-8, Latin-1)

Looks like in the case of latin-1 I need to add utf8_encode before to get the same results. Here is an example

// utf-8
$input = urldecode('%20%C3%9Cbersetzung%20franz');
$output = trim(($input));
$output2 = urlencode($output);
echo $input.'<br>'.$output.'<br>'.$output2;
echo '<a href="'.$output2.'">output 2</a>';

echo '<hr>';
// latin 1
$input = urldecode('%DCbersetzung+franz');
$out = trim(utf8_encode($input));
$out2 = urlencode($out);
echo $input.'<br>'.$out.'<br>'.$out2;
echo '<a href="'.$out2.'">output 2</a>';


The latin-1 seems to need the utf8-encode to get the same result. Has anybody an idea on how to solve this? I need a function that works for latin-1 and UTF-8.

Thank you in advance for any help,

Merlin

--
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