[PerlChina] HTML::TreeBuilder的encode问题

rorot yang.liana at gmail.com
Sun May 11 20:22:19 PDT 2008


大家好。

有个HTML::DOM, HTML::TreeBuilder问题,一直没有很好的解决。

就是当 &nbsp, &gt, &lt; 等字符出现在HTML内容里时,HTML::DOM模块似乎并不能很好的解析,比如:<p>hello,
&nbsp; &gt; world!</p>出现时.
用HTML::DOM::as_text打印出来的p的文本里'&'符号被(encoding/decoding?)处理成乱码了。

如何处理这种情况呢?

当然,可以在parse之前就先把$content =~ s,\&nbsp;, ,g 来处理。但是我想知道DOM::HTML就无法解决这个问题吗?

谢谢!

rorot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/china-pm/attachments/20080512/92146465/attachment.html 


More information about the China-pm mailing list