Re: How about a saveXHTML for the DOM?
| From: | Michael Shadle | Date: | Thu, 09 Apr 2009 07:32:49 +0000 |
| Subject: | Re: How about a saveXHTML for the DOM? | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-291276@lists.php.net to get a copy of this message | ||
On Thu, Apr 9, 2009 at 12:25 AM, Michael A. Peters <mpeters@mac.com> wrote:
> I did a little reading on the issue and I don't think php 6 will fix it.
> The issue is with libxml2 - it mutilates utf8 when exporting to html and php
> function wraps the libxml2 function.
>
> The solution?
> I don't know - but perhaps using saveXML() and then using a translation tool
> (maybe xslt?) to convert to HTML.
>
> I actually had a function I wrote using preg_replace (started out as a
> wordpress plugin someone else wrote) but it could not properly handle cdata
> blocks - I'll see if I can find it.
>
> I don't use it anymore as I use saveHTML() now for html output.
>
> Maybe running iconv on the output would fix it?
>
I tried to the best of my abilities. it looks like it was reported as
a bug years ago, but classified as not a bug or something.
I tried iconv, I am not the best hacker when it comes to encoding manipulation.
At the moment this was the best workaround someone had posted, and I
have not sanity checked that this gets into MySQL then back out on the
webpage properly as UTF-8, but it -appears- to work
html_entity_decode($dom->saveHTML(),ENT_QUOTES,"UTF-8");