in reply to A problem with dash typography
G'day hsmyers,
When your source code contains UTF-8, you need to tell Perl about this. You do this with the utf8 pragma. See that documentation for more complete details on that (somewhat oversimplified) advice.
Here's my test:
#!/usr/bin/env perl -l use strict; use warnings; #use utf8; use HTML::Entities qw{encode_entities}; my $dash = 'DASH: "-"'; my $emdash = 'EMDASH: "—"'; my $endash = 'ENDASH: "–"'; print encode_entities($_) for ($dash, $emdash, $endash);
Output from this code:
DASH: "-" EMDASH: "—" ENDASH: "–"
Output after uncommenting "#use utf8;":
DASH: "-" EMDASH: "—" ENDASH: "–"
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A problem with dash typography
by hsmyers (Canon) on Sep 09, 2015 at 14:58 UTC |