Encoding problem: Rsquo to a with a hat

A

afrinspray

I posted a message titled "Best way to remove body/html tag from
HTML::Element tree" on Sep 6 2006.

Tad McClellan helped me out by referring me to
http://perlmonks.org/?node_id=554219 which explains using
XML::SAX::Writer. Everything was going well with the tag parsing until
I started giving the sax parser special characters for quotes:

Hopefully these characters make it through... it's converting:
& r s q u o ; (no spaces)
to:
â (a with a hat)

Thanks in advance....


Mike
 
A

afrinspray

Ok after some research I think I can better narrow down the problem I'm
having. The module XML::Filter::SAX1toSAX2 is converting my html
entities (  &#8217 etc...) to weird characters.

I changed the XML::SAX::Machines Pipeline in my code from this:
my $machine = Pipeline(
'XML::Filter::SAX1toSAX2' =>
'XML::Filter::BufferText' =>
'XML::Filter::HtmlTagStripper' =>
$writer
);

to
my $machine = Pipeline(
'XML::Filter::SAX1toSAX2' =>
\*STDOUT
);

and it's converting the entities to gibberish. Is there another
SAX1toSAX2 like module out there? Can anyone thing of a replacement?
If i remove the SAX1toSAX2 call from the Pipeline, there's no output.

Also, on a side note I previous decoded the input using
MIME::Decoder...

Any help would be greatly appreciated.

Mike
 
A

afrinspray

Todd said:
1: you are not exporting the data from perl as UTF8
and/or
2: your document reader is either not configured to or capable of rendering
UTF8.
...
binmode STDOUT, ":utf8";
...
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">


Thanks so much for your reply! I totally understand what's going on
now. My problem is a combination of both one and two. I was getting
the "Wide character in print" warning as well, so I must not be
exporting to utf-8 correctly. Also, I'm reading the content in both
firefox and ie, so I'll have to add the charset to the meta tag as you
did above.

Thanks again for your help,
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top