when I have <?php __('Écoutez votre grand-mère'); ?>
I have an output with question mark chars like: �coutez votre grand-m�re
. Charset is set to utf-8 in my header. Wh开发者_StackOverflow中文版at's wrong ?
This happened to a colleague a few days ago. He was using Eclipse and he was not saving the file as UTF-8.
Check the consistency of:
- The encoding of the source file containing the message.
- The encoding of the i18n message files, if any.
- The content-encoding in the HTTP response header
- The encoding specified in the HTML header
- The encoding you browser chooses to render the page
Does it work if you do not use __() and just echo the message?
If you're saving your files as UTF-8 and still getting the same error, it might be a server issue. Add this line at the beginning of your app/config/bootstrap.php file:
header('Content-Type: text/html; charset=utf-8');
It's probably not the best solution, but it does the trick.
精彩评论