Hi Sven,

here you are.
It's possible you get into minor troubles parsing the files, but the code is short enough to even copy/paste it into Pharo I guess. Since it is a fileout from VAST, you may need to tweak the categories for monticello and such.

Please let me know if there are problems with the code, if you add new tests or find bugs. I'd like to add stuff back to my code then.

Good luck,

Joachim



Am 06.12.13 12:06, schrieb Sven Van Caekenberghe:
On 06 Dec 2013, at 12:04, jtuc...@objektfabrik.de wrote:

Hi Sven,

Of course I don't mind. I'll be happy if you find it useful enough to use it in 
Pharo.
Great!

The .dat is VAST's proprietary export format for code. So you'd have to install 
VAST to get it.

I am not a Pharo contributor yet, so I will see if I can send you a fileout of 
the code that should beasier to import into Pharo. I know this is stupid, but I 
never worried about the license of such mini-contributions. So if you want, 
it's MIT ;-)
Yes, please send some .st files.

Joachim



Am 06.12.13 11:36, schrieb Sven Van Caekenberghe:
Hi Joachim,

On 06 Dec 2013, at 11:22, jtuc...@objektfabrik.de wrote:

Hi Sabine,

this is not of immediate help for you, but I once wrote a QuotedPrintableEncode 
for VA Smalltalk. It is in productive use and should handle both encoding and 
decoding just fine.
You can find it on vastgoodies.com and I am sure it is not hard to port to 
Pharo.
So I guess you are OK with me looking at / porting your code ? Is it MIT 
licensed or compatible ? Are you already a signed up Pharo contributor ?

How do you I get at the actual code ?

When doing a download, I get a .dat file. How do I open that ?

Sven

More details: 
http://joachimtuchel.wordpress.com/2011/09/23/quotedprintablecoder-on-vastgoodies/

HTH,

Joachim


Am 06.12.13 11:11, schrieb Sabine Knöfel:
Hi Sven,

this would be great.

I need it for sending mails and some mail reader, e.g. Thunderbird on Mac 
(Thank you Joachim for reporting this bug :-) ) need this in the subject if 
there are special signs in it.

Example:
Subject: =?ISO-8859-1?Q?Kindle_f=FCr_nur_49_EUR?=

Regards
Sabine


On Fri, Dec 6, 2013 at 10:54 AM, Sven Van Caekenberghe-2 [via Smalltalk] <[hidden email] 
</user/SendEmail.jtp?type=node&node=4727928&i=0>> wrote:

    Yes, indeed

    QuotedPrintableMimeConverter>>#mimeEncode is missing.

    It shouldn’t be too hard to implement, although it is a bit of a
    ‘human’ format rather than a technical one.

    http://en.wikipedia.org/wiki/Quoted-printable

    I’ll see what I can do.

    Sven

    On 06 Dec 2013, at 09:35, Sabine Knöfel <[hidden email]
    <http://user/SendEmail.jtp?type=node&node=4727919&i=0>> wrote:

    > Hi,
    >
    > I need this, too.
    >
    >
    
http://forum.world.st/Issue-4782-Quoted-printable-encoding-incomplete-implementation-td3823737.html
    >

    > The bug was closed after transferring it to fogbugs:
    >
    > https://pharo.fogbugz.com/f/cases/4825
    >
    > Sebastian, may I ask you, how did you solve this?
    >
    > regards
    > Sabine
    >
    >
    >
    >
    > --
    > View this message in context:
    
http://forum.world.st/MimeConverter-forEncoding-quoted-printable-subclass-responsibility-tp4727895.html
    > Sent from the Pharo Smalltalk Users mailing list archive at
    Nabble.com.
    >




    ------------------------------------------------------------------------
    If you reply to this email, your message will be added to the
    discussion below:
    
http://forum.world.st/MimeConverter-forEncoding-quoted-printable-subclass-responsibility-tp4727895p4727919.html

    To start a new topic under Pharo Smalltalk Users, email [hidden
    email] </user/SendEmail.jtp?type=node&node=4727928&i=1>
    To unsubscribe from (MimeConverter forEncoding:
    'quoted-printable') subclass responsibility, click here.
    NAML
    
<http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




------------------------------------------------------------------------
View this message in context: Re: (MimeConverter forEncoding: 'quoted-printable') 
subclass responsibility 
<http://forum.world.st/MimeConverter-forEncoding-quoted-printable-subclass-responsibility-tp4727895p4727928.html>
Sent from the Pharo Smalltalk Users mailing list archive 
<http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html> at Nabble.com.
--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:jtuc...@objektfabrik.de
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1


--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:jtuc...@objektfabrik.de
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1






--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:jtuc...@objektfabrik.de
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1

Object subclass: #QuotedPrintableCoder
  instanceVariableNames: ''
  classVariableNames: ''
  poolDictionaries: ''!

!QuotedPrintableCoder class publicMethods !

decode: aString

        | input output char outChar |

        input := aString readStream.
        output := WriteStream on: (String new: aString size).
        
        [input atEnd] whileFalse: [
                char := input next.
                outChar := (char = $=
                        ifTrue: [
                                (char := input next) = Character cr
                                        ifTrue: [
                                                "soft line break ( see rfc 
2045) - just ignore and skip the next character if it is an Lf (Windows)"
                                                input next = Character lf 
ifFalse: [input skip: -1].
                                                nil]
                                        ifFalse: [
                                                "This is an encoded character 
with a leading ="
                                                Character codePoint:
                                                        char asUppercase 
digitValue * 16 + input next asUppercase digitValue]]
                        ifFalse: [char]).
                outChar notNil ifTrue: [output nextPut: outChar]].

        ^output contents!

encode: aString

        | input output char charValue lineLength |

        input := aString readStream.
        output := WriteStream on: (String new: aString size).

        lineLength := 0.
        [input atEnd] whileFalse: [
                lineLength >= 74
                        ifTrue: [
                                output nextPut: $=.
                                output nextPutAll: output lineDelimiter. "This 
may be a Cr only or a CrLf"
                                lineLength := 0].
                char := input next.
                charValue := char asInteger.
                (charValue = 9 | (charValue between: 32 and: 60) | (charValue 
between: 62 and: 126))
                        ifTrue: [
                                output nextPut: char.
                                lineLength := lineLength + 1]
                        ifFalse: [
                                char = Character cr
                                        ifTrue: [
                                                output nextPutAll: '=0D=0A'.
                                                input next = Character lf 
ifFalse: [input skip: -1]. "if on our platform a line end is cr+lf, ignore the 
lf"
                                                lineLength := 0]
                                        ifFalse: [
                                                output nextPut: $=.
                                                output nextPutAll: (char 
asInteger abtHexPaddedTo: 2).
                                                lineLength := lineLength + 3]]].
        ^output contents! !
TestCase subclass: #QuotedPrintableCoderTest
    classInstanceVariableNames: ''
    instanceVariableNames: 'coder '
    classVariableNames: ''
    poolDictionaries: ''!

!QuotedPrintableCoderTest publicMethods !

setUp
 coder := QuotedPrintableCoder!

testDecodeCRLF

        self assert: (coder decode: 'This is the first line=0D=0A and this is 
the second') = 'This is the first line
 and this is the second'!

testDecodeDecodedStrings

        self assert: (coder decode: 'H�tten H�te ein � im Namen, w�ren sie 
m�glicherweise keine H�te mehr') = 'H�tten H�te ein � im Namen, w�ren sie 
m�glicherweise keine H�te mehr'!

testDecodeSimpleStrings

        self assert: (coder decode: 'Z=FCrich')= 'Z�rich'.
        self assert: (coder decode: 'H=E4tten H=FCte ein =DF im Namen, w=E4ren 
sie m=F6glicherweise keine H=FCte mehr') = 'H�tten H�te ein � im Namen, w�ren 
sie m�glicherweise keine H�te mehr'!

testDecodeSoftLinebreak

        self assert: (coder decode: 'This is text may not be=
 decoded as two lines') = 'This is text may not be decoded as two lines'!

testEncodeCRLF

        self assert: (coder encode: 'This is the first line
 and this is the second') = 'This is the first line=0D=0A and this is the 
second'!

testEncodeEncodedStrings

        "An = becomes =3D and is then not decodable any more (only if you know 
you have to do it twice ;-) )"
        self assert: (coder encode: 'Z=FCrich')= 'Z=3DFCrich'.!

testEncodeSimpleStrings

        self assert: (coder encode: 'Z�rich')= 'Z=FCrich'.
        self assert: (coder encode: '�ber die F�hrverbindungen nach F�hr w��te 
ich nicht viel') = '=DCber die F=E4hrverbindungen nach F=F6hr w=FC=DFte ich 
nicht viel'!

testEncodeSoftLinebreak

        | original encoded |

        original :=
                'Cowards die many times before their deaths; The valiant never 
taste of death but once.
Of all the wonders that I yet have heard, it seems to me most strange that men 
should fear;
Seeing that death, a necessary end, will come when it will come'.

        encoded :=
                'Cowards die many times before their deaths; The valiant never 
taste of dea=
th but once.=0D=0AOf all the wonders that I yet have heard, it seems to me most 
strange that=
 men should fear;=0D=0ASeeing that death, a necessary end, will come when it 
will come'.

        self assert: (coder encode: original) = encoded.
        
        self assert: (coder decode: encoded) = original.! !

QuotedPrintableCoderTest initializeAfterLoad!

Reply via email to