Guy Rutenberg

Keeping track of what I do

Question Marks Instead of Non-ASCII Chars when using Gettext in PHP

without comments

Yesterday I’ve ported a PHP website to use Gettext for localizations (l10n). After reading through the Gettext documentation and going through the documentation in the PHP site, I’ve manged to get everything working (almost). I had one problem, all the non-ASCII characters (accented Latin chars, Japanese and Chinese) where displayed as question marks (?) instead of the correct form. This happend despite me using UTF-8 encoded files.

While some people (e.g. this one) suggested that it’s not possible to use non-ASCII characters when using a UTF-8 encoded message files, their is a soultion and it’s quiet simple one. All you have to do is to call bind_textdomain_codset and pass it UTF-8 as charset.

Share and Enjoy:
  • del.icio.us
  • StumbleUpon
  • Digg
  • Facebook
  • Mixx
  • Google Bookmarks
  • Simpy

Written by Guy

November 24th, 2008 at 5:54 pm

Posted in PHP

Tagged with ,

Leave a Reply