From: Xavier Noria Date: 2007-02-14T03:58:53+09:00 Subject: Re: Non-English characters On Feb 13, 2007, at 7:00 PM, Thiago Arrais wrote: > Has anyone seen a non-english characters library for Ruby walking > around? For now, I need to remove letter decorators (in other words, > '�' becomes n and '�' becomes a) and drop non-alphanumeric > characters ('!etter' becomes 'etter'). > > Those are some pretty simple functions that I could write myself > (actually I already have), but it would be nice to use some better > tested code. The best approach I've seen[*] is to decompose and map to ASCII: Iconv.iconv('ascii//ignore//translit', 'utf-8', str) and then sanitize. I think this is better than the technique that passes through Unicode decomposition because it also handles � (ss), � (EUR), � (ae), � (oe), etc. -- fxn [*] Seen in the source of the Rails plugin acts_as_friendly_param, which in turn takes the idea from Mephisto.