thebuzz Posted August 16, 2006 Share Posted August 16, 2006 HiyaI 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 kursenWhich should turn into ØK holder kursendoing 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... Quote Link to comment Share on other sites More sharing options...
effigy Posted August 16, 2006 Share Posted August 16, 2006 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.[code]<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>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.