The base64 package does not decode base64 encoded content with newlines, as is typical
w/ email attachments and most base64 implementations every 76 characters.
The Mime RFC (2045) section 6.8 specifies all non-alphanumeric characters must be
ignored by a compliant decoder, but warnings/errors might be appropriate under some
circumstances.
Attached is a small go base64 program- base64.go. Using it along w/ the system's base64
command, it is easy to reproduce the issue:
1) WORKS, no newlines:
$ echo -n "Hello, World" | base64 -w 0 | ./base64-go
Hello, World
2) BROKEN, newlines every 12 characters:
$ echo -n "Hello, World" | base64 -w 12 | ./base64-go
Hello, Wo
illegal base64 data at input byte 12
Which compiler are you using (5g, 6g, 8g, gccgo)? 8g
Which operating system are you using? Linux i686
Which revision are you using? 0beb796b4ef8+ weekly/weekly.2011-12-02
Please provide any additional information below.
by jason.swank:
Attachments: