Re: unicode conversion

seth vidal <[email protected]>
Newsgroups gmane.linux.rpm.metadata
Message-ID <1067310291.584.25.camel@binkley>
> try:
>     # this will validate UTF-8
>     string = unicode(string, 'utf-8', 'strict')
> except UnicodeError, e:
>     # replaces invalid chars with '?'
>     string = unicode(string, 'iso-8859-1', 'replace')
> 
> return string

Thanks,
 I wasn't aware that unicode.encode() was able to do the replacement
internally.

-sv
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.