I use utf8_decode to convert utf8 string feed to Danish iso-8859-1, which should be rather simple...
Feed string is forexample $news->body
ÃƒËœK holder kursen
Which should turn into
ØK holder kursen
utf8_decode(utf8_decode($news->body)) returns bad chars tho it converts lowercase æøå to the right letters, however capital letters ÆØÅ isnt converted.
Anyone has some suggestions?
I also do not understand why it has to be utf8_decode decoded twice...
Convert UTF8 to danish letters... Not so simple as I thought
1 reply to this topic
Posted 16 August 2006 - 01:54 PM
I'm not a guru at this, but my testing is below. As far as I know, I think your data is either corrupt or not UTF-8 encoded.
<pre> <?php $format = '%-30s=>%20s'; ### Create an O slash. $O_slash = pack("c*", 0xc3, 0x98); printf($format, 'UTF-8 O slash', $O_slash); echo '<br />'; ### Decode it. printf($format, 'Decoded O slash', utf8_decode($O_slash)); echo '<br />'; ### Encode it? This is incorrect... printf($format, 'Encoded encoded O slash', utf8_encode($O_slash)); echo '<br />'; ### What the string should really be. $should_be = $O_slash . 'K holder kursen'; printf($format, utf8_decode("'$should_be' should be"), $should_be); ?> </pre>
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users