Utf 8 Decoding Database Data

Hello everybody

I am currently trying to get some utf 8 encoded data from the data base:

For example the String “Message’s” is saved as “Message’s”

Without yii when echoing it out it was enough to have the charset set on utf-8.

Yii however echos out "Message’s" although its charset is utf-8 too.

I have already tried php’s utf8_decode() function but it just returns some gibberish:

Message�??s

So my Question is: How am i able to echo out the decoded String?

Make sure your database character set is utf8 – UTF-8 Unicode

You should be able to convert those characters like this:


<?php

  echo mb_convert_encoding(

    $someData,

    "HTML-ENTITIES",

    "UTF-8"

  );

?>

Thanks for your reply, i just tried it but it didn’t change anything :confused:

charset is set to utf8 in the database but it still echos "Message’s"

Ok, looks like removing the line ‘charset’ => ‘utf8’, in the config file has somehow solved it