Base64 encoding/decoding

Riccardo Galli riccardo_cut-me at cut.me.sideralis.net
Wed Mar 17 14:10:34 EST 2004


On Wed, 17 Mar 2004 17:02:25 +0100, Oliver Kurz wrote:

> Hello,
> 
> I have a problem by converting a string to base64 and back again.
> 
> I have a string with german special chars like äöüß. 
> 
> This string i convert with base64str=base64.encode('äöüß') into a base64 
> representation.

encode you string in utf

>>> lol='äöüß'.decode('iso-8859-1').encode('UTF8')
'\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x9f'
>>> base64.decodestring(base64.encodestring(lol))
'\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x9f

this should work

Ciao,
Riccardo

-- 
-=Riccardo Galli=-

 _,e.
s~  ``
 ~@.   ideralis Programs
.   ol 
 `**~  http://www.sideralis.net



More information about the Python-list mailing list