base64 Incorrect Padding

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Aug 1 03:02:56 CEST 2009


En Fri, 31 Jul 2009 18:58:43 -0300, bfrederi <brfredericks at gmail.com>  
escribió:

> So what if I used a different encoding that isn't ASCII? Like UTF-8?
> Would that give me lengths that are multiples of 4 based on how the
> characters are represented? Or would I still need to pad with '='?

It doesn't matter, a base64-encoded string contains only ASCII characters.
How are you encoding the text? base64.b64encode does the padding for you,  
so you don't have to worry about that. Do as P. Otten suggests, try to  
send some known text and see what you actually get on the server. Most  
likely you'll find another problem (like trying to decode the complete  
HTTP response instead of just the entity body, or some other stupid  
mistake :) ).

-- 
Gabriel Genellina




More information about the Python-list mailing list