From: Paul Battley Date: 2005-04-05T18:30:28+09:00 Subject: Re: How to handle Iconv errors (newbie question) On Apr 5, 2005 10:25 AM, Matthew Huggett wrote: > It's not crucial for my script to print every string in the array, so > I'd like to just ignore any that Iconv can't handle. How can I handle > the Iconv error so that the processing of the array can continue? Pehaps the best solution is just to tell iconv to skip over illegal sequences in the source string. To do this, append "//IGNORE" to the +to+ string. E.g. ill = "foo\776\776bar" # Illegal utf-8 string Iconv.iconv('ISO-8859-15', 'UTF-8', ill) # Raises Iconv::IllegalSequence Iconv.iconv('ISO-8859-15//IGNORE', 'UTF-8', ill) # => "foobar" Paul.