From: "Hubert Łępicki" Date: 2008-09-30T22:20:37+09:00 Subject: Re: Reliable character encodings conversion 2008/9/30 James Gray : > On Sep 30, 2008, at 7:30 AM, Hubert Łępicki wrote: > >> I am using Iconv library wrapper to convert texts to UTF8, but it's >> throwing "Iconv::IllegalSequence" exception. > > You can add a //TRANSLIT to the end of the "to" encoding to have Iconv > attempt to convert characters to reasonable equivalents in that encoding. > This is usually more helpful when your input is all one encoding and just > has some characters that won't translate well (like a UTF-8 … going to > ISO-8859-1). > > Your case of mixed encodings is probably best handled with //IGNORE instead, > which asks Iconv to skip over any characters that cannot be converted. You > will loose some data with this, but it will convert what it can. > > You can also use //TRANSLIT//IGNORE to convert what can be converted and > skip the rest. > Thanks, //IGNORE//TRANSLIT seems to help a bit - but it's not perfect. I am loosing characters like British pound that were placed in us-ascii encoding for example. Is there some smart library out there that can help with common problems like this one? I have noticed that there is ICU (http://www.icu-project.org/) library for C++ that I could use if it's any smarter - anyone had any experience with it? Best, H. > Hope that helps. > > James Edward Gray II > -- Pozdrawiam, Hubert Łępicki ----------------------------------------------- [ http://hubertlepicki.com ]