Unicode -> String problem

Paul Prescod paulp at ActiveState.com
Sun Jul 8 17:34:19 EDT 2001


Jay Parlar wrote:
> 
>... Is there a simple way to convert the unicode text to
> StringType, removing the resulting unicode strings for unrepresentable > characters?

>>> import codecs
>>> codecs.ascii_encode(u"foo\u3333bar", "ignore")
('foobar', 7)

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook




More information about the Python-list mailing list