[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: iso8859 -> utf8 -> base64 code?

Christian Nygaard wrote:
Hi can somebody please post working iso8859 -> utf8 -> base64
Perl/Python conversion code?

Assuming Python 2.0 or newer:

# Import base64 module
import base64

# raw string with ISO-8859-1 chars
s='Michael Str\xf6der'

# Create Unicode object from s with known charset/encoding

# Copy UTF-8 encoding to raw string

# base64-encode the raw string into new raw string b

Ciao, Michael.