Encoding problems using PHP Gettext -


i trying start using gettext php project.

however, have encoding problems. if use utf-8 encoding in .mo files , use "bind_textdomain_codeset('messages', 'utf-8');" don't see accents in browser. in firefox, in order see them ok, have change browser codification utf-8 (it not default encoding). can't expect visitators change browser encoding, should do?

i tried changing iso-8859-15 and, although accents work ok (even browser default encoding), € sign doesn't work. , have read there problemas when using languages russian, doesn't seem right way.

how should proceed?

thank :)

you should instruct browser page sending encoded in utf-8. using header before output content:

header('content-type: text/html; charset=utf-8'); 

of course assumes page is in utf-8 in first place.

in general, 1 law can never disregard content in page must in same encoding (and that's encoding use when declaring content-type).

if sources content (e.g. hardcoded stuff, comes gettext, comes database) in encoding, fine. if not have manually convert content sources diverge encoding of page, possible through iconv or mb_convert_encoding.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -