About mime encoding

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

About mime encoding

Stéphane Ducasse
Hi

in the squeak trunk

jcg in collections-jcg.124 did

mimeEncode: aStream
        "Return a ReadWriteStream of characters.  The data of aStream is encoded as 65 innocuous characters.  (See class comment). 3 bytes in aStream goes to 4 bytes in output."

        | me |
>> aStream position: 0.
        me := self new dataStream: aStream.
        me mimeStream: (ReadWriteStream on: (String new: aStream size + 20 * 4 // 3)).
        me mimeEncode.
        me mimeStream position: 0.
        ^ me mimeStream

I would like to know if one of you agree on that.

Thanks
Stef
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: About mime encoding

Nicolas Cellier
Sounds hackish to me. You are right to ask for a rationale and a
requirement before letting such line in.

Nicolas

2010/1/15 Stéphane Ducasse <[hidden email]>:

> Hi
>
> in the squeak trunk
>
> jcg in collections-jcg.124 did
>
> mimeEncode: aStream
>        "Return a ReadWriteStream of characters.  The data of aStream is encoded as 65 innocuous characters.  (See class comment). 3 bytes in aStream goes to 4 bytes in output."
>
>        | me |
>>>      aStream position: 0.
>        me := self new dataStream: aStream.
>        me mimeStream: (ReadWriteStream on: (String new: aStream size + 20 * 4 // 3)).
>        me mimeEncode.
>        me mimeStream position: 0.
>        ^ me mimeStream
>
> I would like to know if one of you agree on that.
>
> Thanks
> Stef
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: About mime encoding

Levente Uzonyi-2
On Fri, 15 Jan 2010, Nicolas Cellier wrote:

> Sounds hackish to me. You are right to ask for a rationale and a
> requirement before letting such line in.

The line is in Pharo, but not in Squeak.


Levente

>
> Nicolas
>
> 2010/1/15 Stéphane Ducasse <[hidden email]>:
>> Hi
>>
>> in the squeak trunk
>>
>> jcg in collections-jcg.124 did
>>
>> mimeEncode: aStream
>>        "Return a ReadWriteStream of characters.  The data of aStream is encoded as 65 innocuous characters.  (See class comment). 3 bytes in aStream goes to 4 bytes in output."
>>
>>        | me |
>>>>      aStream position: 0.
>>        me := self new dataStream: aStream.
>>        me mimeStream: (ReadWriteStream on: (String new: aStream size + 20 * 4 // 3)).
>>        me mimeEncode.
>>        me mimeStream position: 0.
>>        ^ me mimeStream
>>
>> I would like to know if one of you agree on that.
>>
>> Thanks
>> Stef
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: About mime encoding

Nicolas Cellier
2010/1/15 Levente Uzonyi <[hidden email]>:

> On Fri, 15 Jan 2010, Nicolas Cellier wrote:
>
>> Sounds hackish to me. You are right to ask for a rationale and a
>> requirement before letting such line in.
>
> The line is in Pharo, but not in Squeak.
>
>
> Levente
>

Oh, then it's easier, just post a short ultimatum and if no hands up, slay!

Nicolas

>>
>> Nicolas
>>
>> 2010/1/15 Stéphane Ducasse <[hidden email]>:
>>>
>>> Hi
>>>
>>> in the squeak trunk
>>>
>>> jcg in collections-jcg.124 did
>>>
>>> mimeEncode: aStream
>>>        "Return a ReadWriteStream of characters.  The data of aStream is
>>> encoded as 65 innocuous characters.  (See class comment). 3 bytes in aStream
>>> goes to 4 bytes in output."
>>>
>>>        | me |
>>>>>
>>>>>      aStream position: 0.
>>>
>>>        me := self new dataStream: aStream.
>>>        me mimeStream: (ReadWriteStream on: (String new: aStream size + 20
>>> * 4 // 3)).
>>>        me mimeEncode.
>>>        me mimeStream position: 0.
>>>        ^ me mimeStream
>>>
>>> I would like to know if one of you agree on that.
>>>
>>> Thanks
>>> Stef
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: About mime encoding

Stéphane Ducasse
Thanks

http://code.google.com/p/pharo/issues/detail?id=1822

Stef (I was in place where pop and smtp are forbidden ;-/ yes I could attack the nasa with them).

On Jan 15, 2010, at 9:22 PM, Nicolas Cellier wrote:

> 2010/1/15 Levente Uzonyi <[hidden email]>:
>> On Fri, 15 Jan 2010, Nicolas Cellier wrote:
>>
>>> Sounds hackish to me. You are right to ask for a rationale and a
>>> requirement before letting such line in.
>>
>> The line is in Pharo, but not in Squeak.
>>
>>
>> Levente
>>
>
> Oh, then it's easier, just post a short ultimatum and if no hands up, slay!
>
> Nicolas
>
>>>
>>> Nicolas
>>>
>>> 2010/1/15 Stéphane Ducasse <[hidden email]>:
>>>>
>>>> Hi
>>>>
>>>> in the squeak trunk
>>>>
>>>> jcg in collections-jcg.124 did
>>>>
>>>> mimeEncode: aStream
>>>>        "Return a ReadWriteStream of characters.  The data of aStream is
>>>> encoded as 65 innocuous characters.  (See class comment). 3 bytes in aStream
>>>> goes to 4 bytes in output."
>>>>
>>>>        | me |
>>>>>>
>>>>>>      aStream position: 0.
>>>>
>>>>        me := self new dataStream: aStream.
>>>>        me mimeStream: (ReadWriteStream on: (String new: aStream size + 20
>>>> * 4 // 3)).
>>>>        me mimeEncode.
>>>>        me mimeStream position: 0.
>>>>        ^ me mimeStream
>>>>
>>>> I would like to know if one of you agree on that.
>>>>
>>>> Thanks
>>>> Stef
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> [hidden email]
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: About mime encoding

Stéphane Ducasse
In reply to this post by Nicolas Cellier
now


mimeEncode: aStream
       "Return a ReadWriteStream of characters.  The data of aStream is encoded as 65 innocuous characters.  (See class comment). 3 bytes in aStream goes to 4 bytes in output."

       | me |
       me := self new dataStream: aStream.
       me mimeStream: (ReadWriteStream on: (String new: aStream size + 20 * 4 // 3)).
       me mimeEncode.
       me mimeStream position: 0.
       ^ me mimeStream

testMimeEncodeDecode

        | encoded |
        encoded := Base64MimeConverter mimeEncode: message.
        self assert: (encoded contents = 'SGkgVGhlcmUh').
     self assert: ((Base64MimeConverter mimeDecodeToChars: encoded) contents = message contents).


encoded contents = ''

:(

Stef
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: About mime encoding

Stéphane Ducasse
apparently without the repositioning of the stream the mineEncode does not get fed up character
and so nothing happen.

Stef

On Jan 16, 2010, at 12:12 PM, Stéphane Ducasse wrote:

> now
>
>
> mimeEncode: aStream
>       "Return a ReadWriteStream of characters.  The data of aStream is encoded as 65 innocuous characters.  (See class comment). 3 bytes in aStream goes to 4 bytes in output."
>
>       | me |
>       me := self new dataStream: aStream.
>       me mimeStream: (ReadWriteStream on: (String new: aStream size + 20 * 4 // 3)).
>       me mimeEncode.
>       me mimeStream position: 0.
>       ^ me mimeStream
>
> testMimeEncodeDecode
>
> | encoded |
> encoded := Base64MimeConverter mimeEncode: message.
> self assert: (encoded contents = 'SGkgVGhlcmUh').
>     self assert: ((Base64MimeConverter mimeDecodeToChars: encoded) contents = message contents).
>
>
> encoded contents = ''
>
> :(
>
> Stef
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: About mime encoding

Stéphane Ducasse
ok the setup was different and changing the positioning....


On Jan 16, 2010, at 12:26 PM, Stéphane Ducasse wrote:

> apparently without the repositioning of the stream the mineEncode does not get fed up character
> and so nothing happen.
>
> Stef
>
> On Jan 16, 2010, at 12:12 PM, Stéphane Ducasse wrote:
>
>> now
>>
>>
>> mimeEncode: aStream
>>      "Return a ReadWriteStream of characters.  The data of aStream is encoded as 65 innocuous characters.  (See class comment). 3 bytes in aStream goes to 4 bytes in output."
>>
>>      | me |
>>      me := self new dataStream: aStream.
>>      me mimeStream: (ReadWriteStream on: (String new: aStream size + 20 * 4 // 3)).
>>      me mimeEncode.
>>      me mimeStream position: 0.
>>      ^ me mimeStream
>>
>> testMimeEncodeDecode
>>
>> | encoded |
>> encoded := Base64MimeConverter mimeEncode: message.
>> self assert: (encoded contents = 'SGkgVGhlcmUh').
>>    self assert: ((Base64MimeConverter mimeDecodeToChars: encoded) contents = message contents).
>>
>>
>> encoded contents = ''
>>
>> :(
>>
>> Stef
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project