base64 and PyGreSQL

Guido van Rossum guido at python.org
Fri May 19 05:47:49 CEST 2000


Agent Drek wrote:
> 
> Why does the base64 module append a '\012'?
> 
> I'm using base64 to send data into a PostgreSQL database so that
> arbitrary data including ''s and "'s can be entered by the user's ...
> is this the correct way to do this?
> 
> right now :
> string.strip(base64.encodestring(eggs))
> 
> I'm using PyGreSQL.

You seem to have found the solution for your problem.

The answer to the "why" question is simply that in the context
for which base64 was originally designed (encoding binary files
as part of email) the output is always a number of lines,
so it makes sense to add the linefeed.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-list mailing list