|
Posted by Peter J. Holzer on June 23, 2007, 3:37 pm
Please log in for more thread options
>> The MIME::Base64 will convert \n to \r\n.
>>
>> $a="1234\n4567\n";
>> $a=encode_base64($a,0);
>> print decode_base64($a);
>>
>> The result is 1234\r\n4567\r\n.
Not on my system (perl, v5.8.8 built for i486-linux-gnu-thread-multi,
MIME::Base64 3.07). Are you using Windows?
> Look for http://www.ietf.org/rfc/rfc2045.txt [Page 25]
>
> Care must be taken to use the proper octets for line breaks if
> base64 encoding is applied directly to text material that has not
> been converted to canonical form. In particular, text line breaks
> must be converted into CRLF sequences prior to base64 encoding.
> The important thing to note is that this may be done directly by
> the encoder rather than in a prior canonicalization step in some
> implementations.
>
> This RFC requirement.
For "text material that has not been converted to canonical form", yes.
But base64 is most often used to represent non-text material, such as
images, PDFs, word documents, viruses, etc.
But MIME::Base64 has no way of knowing if the string it is passed is
text material, so it should leave canonicalization to the caller (and it
does, AFAICT).
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
|