Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Diacritic-Insensitive and Case-Insensitve Sorting

by ysth (Canon)
on Jan 05, 2004 at 08:32 UTC ( [id://318800]=note: print w/replies, xml ) Need Help??


in reply to Diacritic-Insensitive and Case-Insensitve Sorting

This doesn't help this questioner, but here's what I use for removing Unicode accents:
use 5.008; use charnames (); sub deaccent { # split it into characters, then loop through them converting one +by one my @chars = split //, $_[0]; for my $char (@chars) { # look up the name (e.g. "LATIN SMALL LETTER O WITH TILDE") my $name = charnames::viacode(ord($char)); # only try to convert it if it was a valid char and had " WITH + " if ($name && $name =~ m/(.*) WITH /) { # take off the " WITH foo" and see if that is a valid char my $neword = charnames::vianame("$1"); $char = chr($neword) if $neword; } } return join '', @chars; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-18 07:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found