X
Xavier Noria
I wrote this method
def self.normalize_for_sorting(s)
return nil unless s
norm =3D s.downcase
norm.tr!('=C1=C9=CD=D3=DA', 'aeiou')
norm.tr!('=C0=C8=CC=D2=D9', 'aeiou')
norm.tr!('=C4=CB=CF=D6=DC', 'aeiou')
norm.tr!('=C2=CA=CE=D4=DB', 'aeiou')
norm.tr!('=E1=E9=ED=F3=FA', 'aeiou')
norm.tr!('=E0=E8=EC=F2=F9', 'aeiou')
norm.tr!('=E4=EB=EF=F6=FC', 'aeiou')
norm.tr!('=E2=EA=EE=F4=FB', 'aeiou')
norm
end
to normalize strings for sorting. This script is UTF-8, everything is =20=
UTF-8 in my application, $KCODE is 'u'.
But it does not work, examples:
Andr=E9s -> andruos
L=F3pez -> luupez
P=E9rez -> puorez
I tried to "force" it with Iconv.conv('UTF-8', 'ASCII', 'aeiou') to =20
no avail. Any ideas?
-- fxn
def self.normalize_for_sorting(s)
return nil unless s
norm =3D s.downcase
norm.tr!('=C1=C9=CD=D3=DA', 'aeiou')
norm.tr!('=C0=C8=CC=D2=D9', 'aeiou')
norm.tr!('=C4=CB=CF=D6=DC', 'aeiou')
norm.tr!('=C2=CA=CE=D4=DB', 'aeiou')
norm.tr!('=E1=E9=ED=F3=FA', 'aeiou')
norm.tr!('=E0=E8=EC=F2=F9', 'aeiou')
norm.tr!('=E4=EB=EF=F6=FC', 'aeiou')
norm.tr!('=E2=EA=EE=F4=FB', 'aeiou')
norm
end
to normalize strings for sorting. This script is UTF-8, everything is =20=
UTF-8 in my application, $KCODE is 'u'.
But it does not work, examples:
Andr=E9s -> andruos
L=F3pez -> luupez
P=E9rez -> puorez
I tried to "force" it with Iconv.conv('UTF-8', 'ASCII', 'aeiou') to =20
no avail. Any ideas?
-- fxn