[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: removing diacritical marks from strings
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sun, 15 Apr 2007 21:34:03 -0300
> Does anybody happen to have a mapping (or an algorithm) that will
> remove diacritical marks from strings? I'd like to convert Jérôme to
> Jerome and that sort of thing.
Try something like this (untested):
local t={
['A'] = "ÀÁÂÃÄÅ",
['E'] = "èéêë",
...
}
local T={}
for i=0,255 do
local c=string.char(i)
T[c]=c
end
for k,v in pairs(t) do
for i=1,#v do
T[v:sub(i,i)]=k
end
end
now use string.gsub(source,"(.)",T)
--lhf