473,563 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Base64 encoding/decoding

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=base6 4.encode('äöüß' ) into a base64 representation.

Backwards I got an error:
binascii.Error: Incorrect padding

I use base64.decode(b ase64str).

The charset I use is iso-iso-8859-1.

What am I doing wrong?

Is there somewhere a good tutorial bei encoding and decoding with different charsets?
I get text from different sources and i have to decode it and convert it at the end to utf-8.


--*
--
Oliver*Kurz
Jul 18 '05 #1
1 8067
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=base6 4.encode('äöüß' ) into a base64
representation.


encode you string in utf
lol='äöüß'.deco de('iso-8859-1').encode('UTF 8') '\xc3\xa4\xc3\x b6\xc3\xbc\xc3\ x9f' base64.decodest ring(base64.enc odestring(lol))

'\xc3\xa4\xc3\x b6\xc3\xbc\xc3\ x9f

this should work

Ciao,
Riccardo

--
-=Riccardo Galli=-

_,e.
s~ ``
~@. ideralis Programs
.. ol
`**~ http://www.sideralis.net
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4211
by: Ramy076 | last post by:
I have a C App which uses openssl for Encoding and decoding which needs to be ported to java. The decoded text does not match between the C App and the java App. The size of the output itself is wrong. I think i am doing something basically wrong. pls help. Output is not the same as seen here because of special characters Output from C:...
3
7655
by: Patrick | last post by:
Hi... I have a problem with Mime/base64 decoding. Maybe someone can help. I have an original Text, that I send using outlook. The text is: "This is a testmail ä ü ö é à è" (without the ") So on the mailserver I open the message and the body is base64 encoded and contains VGhpcyBpcyBhIHRlc3RtYWlsIOQg/CD2IOkg4CDoDQo=
27
15006
by: gRizwan | last post by:
Hello all, We have a problem on a webpage. That page is sent some email data in base64 format. what we need to do is, decode the base64 data back to original shape and extract attached image from it. Any help will be highly appriciated. Thanks
3
2291
by: nly | last post by:
What's the purpose of "Base64 encoding and decoding"? Thanks in advance!
9
3833
by: Miguel | last post by:
I am looking for some example of how to encode a string pair (user/password) in base64. I am using basic windows authentication... ¿Could anybody help me? Thank you in advance Miguel
2
7358
by: Kuldeep | last post by:
Hi All, Could you please give me some guidelines on dealing with Base64 encoded string. The actual purpose is to decode Base64 Encoded string and stream the data to a browser so that it can be viewed in a web application Regards, Kuldeep
8
2795
by: Jeremy Kitchen | last post by:
I have encoded a string into Base64 for the purpose of encryption. I then later decrypted it and converted it back from Base64 the final string returns with four nothing characters. "pass" what the result should be "pass____ what the result is where each underline char is a nothing char. I am about to write a function that will remove...
10
4031
by: pycraze | last post by:
Hi , I am currently trying to implement base64 encoding and decoding scheme in C . Python has a module , base64 , that will do the encoding and decoding with ease . I am aware of OpenSSL having support for base64 encoding and decoding , but i will have to now implement both in C without using the openssl libraries . I was able to...
3
6831
by: ashu | last post by:
I am searching for Win32 (or WinMobile) API for converting ASCII string to Base64 and vice-versa can anyone help me out.... Thanks in advance...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7882
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7634
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.