From: Matthew Huggett Date: 2005-04-05T18:45:17+09:00 Subject: Re: How to handle Iconv errors (newbie question) From: Paul Battley > >> 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" That did it. Thanks a lot! Matt