This is a response to what you have here plus other posts throughout this thread.
-
Slashdot nodelet and HackerNews nodelet both have content now. (ref. #11156828)
-
I checked U+2013 EN DASH in a number of places: all seem to be rendered correctly. (ref. OP)
-
In #11156847 you wrote "I needed s/\x{2016}/.../.": that's a "‖" character.
U+2016 DOUBLE VERTICAL LINE may be needed but, from the context, and the fact that this is only mentioned once,
I wondered if this might be a typo.
-
U+201C LEFT DOUBLE QUOTATION MARK and U+201D RIGHT DOUBLE QUOTATION MARK
are the pair "“" & "”".
Instead of converting both to """, perhaps using "“" & "”" might be a better option.
(ref. #11156847 and #11156884)
-
U+2019 RIGHT SINGLE QUOTATION MARK is perhaps being used as a fancy apostrophe;
I'm not seeing an example at the time of writing.
Similar to the last dot point, you might want to proactively address the potential
U+2018 LEFT SINGLE QUOTATION MARK and U+2019 RIGHT SINGLE QUOTATION MARK,
being the pair "‘" & "’".
And in the same vein, "‘" & "’" might be better options.
(ref. #11156847 and #11156884)
Rather than a whole bank of individual s///g, each of which needs to be run for every string,
I'd be more inclined to use a lookup table and a single s///g, which only needs to be run once for every string.
Something along these lines:
$ perl -Mutf8 -C -E '
my %ent_for_char = (
"\x{2013}" => "–",
"\x{2018}" => "‘",
"\x{2019}" => "’",
"\x{201c}" => "“",
"\x{201d}" => "”",
);
my $test_str = "“fancy double” – ‘fancy single’ – fancy’apostrophe";
say $test_str;
$test_str =~ s/(.)/exists $ent_for_char{$1} ? $ent_for_char{$1} : $1/eg;
say $test_str;
'
“fancy double” – ‘fancy single’ – fancy’apostrophe
“fancy double” – ‘fancy single’ – fancy’apostrophe
You can modify the table (e.g. add "\x{2014}" => "—",)
without requiring any changes to the code doing the processing.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.