Nodonomy has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use utf8; use Text::Unidecode; # I download text with embedded HTML numbers , as in # "advice to Gwenda to “let sleeping murder lie.”" # # 8220 is a decimal number for 'left double quotation mark'."; # # To convert this HTML number to a double quote, one can use # the Perl module Text::Unicode. It seems however that one # needs to use a hexadecimal number (in this case '201c') # for the unidecode() function. print "Function unidecode() prints the 'left double quotation mark': " +; print unidecode("\x{201c}") . "\n"; # I can get the hexadecimal number as follows: my $hexval = sprintf("%x", 8220); # MY ACTUAL QUESTION: how to get $hexval into the call to # unidecode()? unidecode("\x\{".$hexval."\}") does not do # the job, and I have tried half a dozen other ways that I # thought would work, but do not. # Does anyone know how to do this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Text:Unidecode question
by Anonyrnous Monk (Hermit) on Jan 28, 2011 at 14:29 UTC | |
by Nodonomy (Novice) on Jan 28, 2011 at 14:44 UTC | |
|
Re: Text:Unidecode question
by Anonymous Monk on Jan 28, 2011 at 13:59 UTC | |
by Nodonomy (Novice) on Jan 28, 2011 at 14:04 UTC | |
by Nodonomy (Novice) on Jan 28, 2011 at 14:15 UTC | |
by Anonymous Monk on Jan 28, 2011 at 14:27 UTC | |
|
Re: Text:Unidecode question
by Anonymous Monk on Feb 01, 2012 at 17:03 UTC | |
by jdporter (Paladin) on Feb 01, 2012 at 19:13 UTC | |
by choroba (Cardinal) on Feb 02, 2012 at 00:08 UTC |