[squeak-dev] Re: [Seaside] SqueakSource/Seaside question - has anyone seen this problem before?

Bob Arning arning315 at comcast.net
Mon Dec 23 16:04:28 UTC 2013


I see how it happens...

using Mac, Chrome with 8859-1 encoding as default, I typed

     S, t, option-e, e, p, h, a, n, e

in the login screen. What arrives back at the server is

     '11=St%E9phane&12=&13=Login'

wherupon HttpRequest tries to parse this
-----
decodeUrlEncodedForm: string multipleValues: boolean
     | dict key value start end eqSignPos more |
     dict _ boolean ifTrue: [HttpFormDictionary new] ifFalse: 
[Dictionary new].
     string isEmptyOrNil ifTrue: [^dict].
     more _ true.
     start _ 1.
     [end _ string indexOf: $& startingAt: start.
     end == 0
         ifTrue: [end _ string size. more _ false]
         ifFalse: [end _ end - 1].
     eqSignPos _ string indexOf: $= startingAt: start.
     (eqSignPos > end or: [eqSignPos == 0])
         ifTrue: [key _ (key _ string copyFrom: start to: end) 
unescapePercents.
             value _ '']
         ifFalse: [key _ (key _ string copyFrom: start to: eqSignPos-1) 
unescapePercents.
             value _ (value _ string copyFrom: eqSignPos+1 to: end) 
*unescapePercents*].
     self addKey: key value: value toForm: dict multipleValues: boolean.
     start _ end + 2.
     more] whileTrue.

     ^dict
-----
and #unescapePercents does

self unescapePercentsWithTextEncoding: 'utf-8'

     'St%E9phane' unescapePercents ==> 'St鰨ane'

whereas, if we knew it was not utf-8, then

     'St%E9phane' unescapePercentsWithTextEncoding: nil ==> 'Stéphane'

gives the expected answer. I tried to coax my browser to return utf-8, 
but that had no effect, so I'm wondering if this application would be 
better off using
unescapePercentsWithTextEncoding: nil
rather than
     unescapePercents

Cheers,
Bob

On 12/23/13 8:15 AM, Philippe Marschall wrote:
> On Mon, Dec 23, 2013 at 1:43 PM, Bob Arning <arning315 at comcast.net> wrote:
>>   It is a WideString and
>>
>> self asArray collect: [ :e | e asciiValue radix: 16] = #('53' '74'
>> '3FC09C28' '61' '6E' '65' '20' '4D' '75' '6E' '69' '6F' '7A')
> Interesting, so somebody somewhere along the way converted the input
> from something (likely utf-8 although the page is iso-8859-1) to
> Squeak encoding.
>
> Cheers
> Philippe
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20131223/59078110/attachment-0001.htm


More information about the seaside mailing list