HTML::Entities isn't correctly handling quotes as defined in this Unicode table.

A poor workman blames his tools :)

http://cpansearch.perl.org/src/GAAS/HTML-Parser-3.68/lib/HTML/Entities.pm
'lsquo;' => chr(8216), 'rsquo;' => chr(8217), 'sbquo;' => chr(8218), 'ldquo;' => chr(8220), 'rdquo;' => chr(8221), 'bdquo;' => chr(8222),

#!/usr/bin/perl -- use strict; use warnings; use utf8; use HTML::Entities; binmode STDOUT, ':encoding(UTF-8)'; { my $line = "This is a test of \xe2\x80\x9cquotes\xe2\x80\x9d\n"; print encode_entities($line, "\200-\377"); # looking for “ & +rdquo; in the output print $line; } print '#' x 11, "\n"; { my $line = 'xThis is a test of '.chr(8220).'quotes'.chr(8222)."\n" +; print encode_entities($line, '\x{201c}\x{201e}'); print $line; } print '#' x 11, "\n"; { my $line = 'xThis is a test of '.chr(8220).'quotes'.chr(8222)."\n" +; print encode_entities($line, chr(8220).chr(8222)); print $line; } __END__ This is a test of “quotes” This is a test of “quotes” ########### xThis is a test of “quotes„ xThis is a test of “quotes„ ########### xThis is a test of “quotes„ xThis is a test of “quotes„

In reply to Re: HTML::Entities and Unicode quotes by Anonymous Monk
in thread HTML::Entities and Unicode quotes by tod222

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.