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