i want to echo $html variable (which contents html code of page) to browser in my php script. but if my $html has cyrillic symbol echo is breaking on it symbol – all before this symbol is on page – but all next is empty, what reason can it be?
Share
The character encoding of the value of
$htmldoes not suit the character encoding you declare your output with. You need to identify the character encoding of$htmland make sure to properly declare your output to be encoded with it.The best way to do that is the HTTP header. You can do that with
header:This declares the content to be HTML encoded with UTF-8.
Besides that, PHP and the web server have default character encodings that are sent if no other was specified. In PHP, the default character encoding is specified by default_charset; and as for Apache web server, it is specified by
AddDefaultCharset.