List Info

Thread: Re: MIME decoding confused by non-MIME characters




Re: MIME decoding confused by non-MIME characters
country flaguser name
Japan
2007-02-28 06:18:06
Brian Candler wrote:
> That is, non-printable characters (here a UTF8-encoded
BOM) are causing MIME
> unpack to return garbage.
>   
Fixed.  Thanks reporting.


Re: MIME decoding confused by non-MIME characters
user name
2007-02-28 13:02:32
On Wed, Feb 28, 2007 at 09:18:06PM +0900, Urabe Shyouhei
wrote:
> Brian Candler wrote:
> > That is, non-printable characters (here a
UTF8-encoded BOM) are causing MIME
> > unpack to return garbage.
> >   
> Fixed.  Thanks reporting.

base64 decoding has same problem, doesn't it?

  > bom = "xEFxBBxBF"
  => "357273277"
  > b64 = ["hello"].pack('m*')
  => "aGVsbG8=n"
  > (bom + b64).unpack('m*')
  => ["$003231[ee"]


Also:

     Any characters outside of the base64 alphabet are to be
ignored in
	 base64-encoded data.
		- RFC2045, section 6.8

Instread, Ruby truncates input:

	>
["a"*40+"b"*20].pack('m*').sub("n&
quot;, " n").unpack('m*')
	=>
["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbb"]

It is common for extra whitespace, at ends of line for
example, to be
present in base64.

Sam



[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )