Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

1) When you use perl with data that isn't ASCII, it's generally a good idea to tell perl what encoding you expect the filehandles to use, by using binmode: binmode(\*STDOUT, ':utf8');. By default, even in utf8 locales, STDIN, STDOUT, and STDERR are assumed to be latin-1. If you had a use warnings, you would have gotten a lot of warnings about a wide character in print -- one for every character that wasn't in latin-1.

2) From that screenshot, it appears that what you have is mostly valid utf8, but the thing you are using to view it expects it to be latin-1, not utf8.

3) It's dangerous to HTML-unescape text containing unescaped HTML or XML tags; after doing so it is impossible to tell the difference between what was <foo> and &lt;foo&gt;, making tags out of things that were not tags before.

4) Why aren't you using a HTML parser, such as HTML::TreeBuilder?


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).


In reply to Re^3: NCR & CER to UTF-8 by theorbtwo
in thread NCR & CER to UTF-8 by vnpenguin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-20 04:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found