dmn001 has asked for the wisdom of the Perl Monks concerning the following question:
I am looking for a perl module that converts any unicode characters in a string to its closest equivalent letter in ascii, (and perhaps, otherwise, the encoded value of it, for example: {)
my $x = 'Château';
some_func($x);
output: 'Chateau';
Note the 'a' has turned into a proper letter 'a', Im not too worried about losing the tilde information, as long as it is human readible, and xml parseable.
Never mind, I found the solution to encode it here: http://perl-xml.sourceforge.net/faq/#encoding_conversion
I guess the solution here is to make a hash of all the unicode letters and map them to the equivalent letter in ascii.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: converting unicode string to ascii or encoded
by ikegami (Patriarch) on Apr 14, 2011 at 23:49 UTC | |
|
Re: converting unicode string to ascii or encoded
by afoken (Chancellor) on Apr 17, 2011 at 06:55 UTC | |
by dmn001 (Initiate) on Apr 17, 2011 at 13:14 UTC | |
by afoken (Chancellor) on Apr 17, 2011 at 14:33 UTC | |
by dmn001 (Initiate) on Apr 17, 2011 at 16:05 UTC |