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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -