I have a php array storing french sentences (latin) with translation preparation like:
myarray = array(
"description" => "more infos",
"rule" => "1",
"out" => __("Merci de l’imprimer, à demain, c'est l'été"));
The __( is here for future translation purposes. Base language is french.
If i output my text into a PDF using Snappy, i get strange utf8 encoded characters like é
I then added
utf8_decode()
to my text before outputting, and it gets much better. But some characters still stay unreadable like
'
converted to
?
Could you help me understanding how to store my ready for translation text and how to output it correctly ? Do i have to encode it before storing in my array ?
Thank you very much
Check out this page. It has the answer to your question! If not then Im sure you'll be able piece the information together and do it yourself!
http://php.net/manual/fr/function.utf8-decode.php
This bit of code might be worth trying. I haven't actually tried it but that php website should get you on the right path.
$array = array_map("utf8_decode", $myarray);
I've tested this bit of code and there are no funny characters outputting :) I've encoded it and then decoded it. You never actually encoded your array so that's why it was printing out odd characters
$myarray = array(
"description" => "more infos",
"rule" => "1",
"out" => "Merci de l’imprimer, à demain, c'est l'été");
$utfEncoded = array_map("utf8_encode", $myarray );
$array = array_map("utf8_decode", $utfEncoded);
print_r($array);