Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Unaccenting characters

by choroba (Chancellor)
on Aug 28, 2013 at 16:59 UTC ( #1051302=note: print w/replies, xml ) Need Help??

in reply to Unaccenting characters

I noticed several problems:
  1. Single quotes do not interpolate. Use $table{"$1"} or even no quotes at all: $table{$1}.
  2. Tell Perl what encoding your script uses. It should be UTF-8 and you should therefore use utf8;.
  3. If you are reading the data from a file, set the input encoding. You can use either
    open my $IN, '<:utf8', $filename or die $!;


    open my $IN, '<', $filename or die $!; binmode $IN, ':utf8';

    Set the output encoding to UTF-8, too, if you plan to output any accented characters.

لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Unaccenting characters
by mwhiting (Beadle) on Aug 29, 2013 at 16:41 UTC
    Hmmm, but I don't know what kind of input I'm getting. I have the 'guess' function running just before this part of the script to determine if I need to encode into UTF8 first or not. Will setting the input encoding to be UTF8 change the input into UTF8, or just tell the server to expect UTF8?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1051302]
[Corion]: A good daypart!
Corion feels slightly bad for initiating a discussion yesterday and then running away. I guess I should write that up as a meditation or SoPW
[Corion]: Not the "running away" part but the question+ discussion about IO-less HTTP modules
[Corion]: (or how/where to patch AnyEvent::HTTP or LWP::UserAgent to take control of both the callstack and the data transfer)

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2016-12-08 08:59 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (137 votes). Check out past polls.