Discussion:
[php-general] gibberish output when using the loadHTMLFile() function.
atar
2013-08-12 00:54:36 UTC
Permalink
Hi there!!

When I'm trying to load an external html document with the loadHTMLFile()
function and then I use the saveHTML() function to output its content,
some text in the external html document which is written in hebrew is
displayed in a gibberish format. is anyone here has an idea how to solve
this problem?

NOTE: the document itself is encoded in utf-8 character set.

Thanks in advance!!

atar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Maciek Sokolewicz
2013-08-12 11:35:50 UTC
Permalink
Post by atar
Hi there!!
When I'm trying to load an external html document with the
loadHTMLFile() function and then I use the saveHTML() function to output
its content, some text in the external html document which is written in
hebrew is displayed in a gibberish format. is anyone here has an idea
how to solve this problem?
NOTE: the document itself is encoded in utf-8 character set.
Thanks in advance!!
atar.
First of all, stop triple-posting to each list. Choose one address, and
stick to it.

As for your question; the character set needs to be announced as well as
set. So to display in UTF-8, you need to:
1. make sure the document is actually encoded using the UTF-8 charset
2. make sure the browser recieves an HTTP header which tells it the
content is in UTF-8: header('Content-type: text/html; charset=utf-8')
3. make sure the document itself states its encoding is UTF-8 (usually
done using a <meta http-equiv="Content-Type" content="text/html;
charset=utf8"/>

If your output conforms to all three of these, it will work. It probably
does not conform to it however.
- Tul
- Tul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...