Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Case shifting on accented characters

by ikegami (Pope)
on Sep 12, 2013 at 20:50 UTC ( #1053797=note: print w/replies, xml ) Need Help??


in reply to Case shifting on accented characters

//i does work on accented characters ...usually. When it doesn't, you can force it to using one of the following methods:

A very likely possibility is that you don't actually have "ť" or "…" in your string or in your code due to forgetting to decode, since you don't normally need the above.

use utf8; # Source file is encoded using UTF-8 print "ť" =~ /…/i ?1:0,"\n"; # 1 print "…" =~ /ť/i ?1:0,"\n"; # 1 print "ť" =~ /\w/ ?1:0,"\n"; # 1 print "…" =~ /\w/ ?1:0,"\n"; # 1

To answer your question, you could go about doing that by lowercasing non-ASCII characters using s/([^\x00-\x7F])/lc($1)/eg; with one of the above used.

use utf8; # UTF-8 code use open ':std', ':encoding(UTF-8)'; # UTF-8 terminal use 5.012; $_ = "LES MIS…RABLES"; s/([^\x00-\x7F])/lc($1)/eg; # LES MISťRABLES say;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1053797]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2017-03-28 01:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (326 votes). Check out past polls.