[Rpm-metadata] unicode conversion

seth vidal skvidal at phy.duke.edu
Tue Oct 28 03:04:52 UTC 2003


> 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





More information about the Rpm-metadata mailing list