Paul Battley wrote:
> On 27/06/06, Alex Young <alex / blackkettle.org> wrote:
>> Is there any way to use the Iconv library to lossily convert between
>> partially incompatible encodings?  In other words, if, for example, I've
>> got a UTF-8 string that I need to convert down to 7-bit ASCII, and I
>> don't especially care what happens to the extended characters (short of
>> a single character being mapped to a single character - ideally one I
>> can specify), is there any way of forcing the recode?
> 
> Yes, there is. Add //IGNORE to the destination encoding to ignore
> unavailable characters, or //TRANSLIT to transliterate them into
> combinations of ASCII characters (e.g. `e for è).
> 
> E.g.:
> 
> #!/usr/bin/env rubby
> $KCODE = 'u'
> require 'iconv'
> 
> s = 'caffè'
> 
> ic_ignore = Iconv.new('US-ASCII//IGNORE', 'UTF-8')
> puts ic_ignore.iconv(s) # => caff

Ooh, that's nice.  Thanks for that.  I guess it's wishful thinking to 
hope for:

puts ic_ignore.iconv(s) # => caffe


-- 
Alex