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
In reply to Re: A problem with dash typography
by kcott
in thread A problem with dash typography
by hsmyers
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |