On 27/06/06, Alex Young <alex / blackkettle.org> wrote:> Ooh, that's nice.  Thanks for that.  I guess it's wishful thinking to> hope for:>> puts ic_ignore.iconv(s) # => caffe
Your wish is granted:
#!/usr/bin/env rubby$KCODE = 'u'require 'unicode'
s = 'caffè'
puts Unicode.normalize_KD(s).gsub(/[^\x00-\x7F]/n,'') # => caffe
It works by decomposing characters and rejecting everything aboveposition 127, which includes all the now-separated accents.
This does require the slightly-flaky unicode library (work is underwayto update it). You can get that from http://www.yoshidam.net/Ruby.htmlor via gems.
Paul.