Re: Re: Re: Re: gibberish output when using the loadHTMLFile() function
| From: | Ferenc Kovacs | Date: | Mon, 11 Nov 2013 07:41:02 +0000 |
| Subject: | Re: Re: Re: Re: gibberish output when using the loadHTMLFile() function | ||
| References: | 1 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-1453@lists.php.net to get a copy of this message | ||
2013.08.12. 11:11, "atar" <atar.yosef@gmail.com> ezt írta:
>
> Hi there!!
>
> I think I've changed all the appropriate encoding parameters:
>
>> mb_internal_encoding("UTF-8");
>> iconv_set_encoding("internal_encoding", "UTF-8");
>> iconv_set_encoding("input_encoding", "UTF-8");
>> iconv_set_encoding("output_encoding", "UTF-8");/*
>> print_r(iconv_get_encoding());
>
>
> Unfortunately, non of them solved that issue.
>
> I've noticed that when I load the HTML page directly into the browser,
it's displayed appropriately when the browser encodes the document with the
UTF-8 charset, but when I instruct the browser to encode the HTML page with
the ISO-8859-1 charset, it's displayed exactly as it is displayed when I
load the HTML document through the "loadHTMLFile()" PHP's function!! this
causes me to think that the "loadHTMLFile()" PHP's function loads its file
argument with the ISO-8859-1 charset. now I apparently need to find a way
to instruct the "loadHTMLFile()" PHP's function to load its file argument
using the UTF-8 charset. I still didn't find this way. if someone has any
idea, I'll be very happy to know!
>
> Thanks in advance!!
>
> atar.
>
>
> --
> PHP Unicode & I18N Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
The domdocument extensions loadhtmlfile method gets the encoding from the
appropriate meta tag in the html.
If it's missing or wrong then you can experience problems like you
mentioned.