Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Unicode and regexes

by dakkar (Hermit)
on Oct 30, 2002 at 17:51 UTC ( #209172=note: print w/replies, xml ) Need Help??


in reply to Unicode and regexes

The regexps, per se, don't need any change (I'm assuming Perl 5.8.0, since 5.6.x had some problems). You need to assure two things:

  1. that your strings are correctly encoded
  2. that Perl knows it

The first is a problem in itself, but a bit off-topic.

The second can be done in two ways:

  1. if the strings come from a filehandle, you can use something like open(FH, "<:utf8", "file") to tell Perl to treat data as utf-8 (or use the :encoding layer, see perldoc -f open
  2. otherwise (such as your example, from a dirhandle), use Encode; and $string=Encode::decode("utf-8",$string);

Replies are listed 'Best First'.
Re: Re: Unicode and regexes
by hotshot (Prior) on Oct 31, 2002 at 07:54 UTC
    and if I still use Perl 5.6.1?

    Hotshot

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://209172]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2018-12-17 02:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many stories does it take before you've heard them all?







    Results (71 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!