Utku Dalmaz
Utku Dalmaz

Reputation: 10172

international character problem

even though php page's header set to UTF-8 i get this error

error

here is meta tag

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

text is coming from php gettext.

how can i solve this ?

thanks

Upvotes: 1

Views: 329

Answers (1)

mario
mario

Reputation: 145492

The output is probably encoded in ISO-8859-1 when it came from gettext. While you could manually convert it with utf8_encode(), there is a builtin feature for gettext which should do that automatically.

See the user comment here: http://www.php.net/manual/en/function.bind-textdomain-codeset.php#67200

In your case you would need:

bind_textdomain_codeset($domain, "UTF-8");

Obviously it would be best if your gettext .mo files were encoded in UTF-8 too.

If that doesn't help yet, try overriding the locale with setlocale("de_DE.UTF-8") or maybe putenv("LC_MESSAGES", "de_DE.UTF-8") and LANG= or similar.

Upvotes: 3

Related Questions