lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

This is all predicted on being in a single-byte locale of course.  "." only matches a byte, not a character.

When Modula-3 came out, we thought it was a little daring and progressive to define the language as ISO Latin-1 rather than ASCII....

Sent from a Treo, excuse infelicities

-----Original Message-----
From: "Luiz Henrique de Figueiredo" <>
To: "Lua list" <>
Sent: 4/15/07 5:34 PM
Subject: Re: removing diacritical marks from strings

> 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)
for k,v in pairs(t) do
	for i=1,#v do

now use string.gsub(source,"(.)",T)