Re: [Zinc, ZnPercentEncoder] problem encoding accents

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

Re: [Zinc, ZnPercentEncoder] problem encoding accents

lpaniceres
Sven
     I saw the tests and they works fine.
The problem is on the field.
I have a form with javascript that gets addresses from Google Maps, then the form is submitted to my Pharo-Zinc-App.
When the form is submitted by Safari(OS X), Smalltalks receives the character with accent without encoding (no %).
Continuing with the Neuquen example,   the 'accented e’ that should be  %C3%A9 is received as the raw character.
With Firefox all works fine, the character is received with the correct encoding.

So the problem is related to ‘decode:’
In the research I  also saw that some accented characters could be received as one character encoded, for example the 'accented e’ could be also %E9.

thanks
Leo


   


El 21/4/2015, a las 18:26, [hidden email] escribió:

Date: Tue, 21 Apr 2015 22:59:52 +0200
From: Sven Van Caekenberghe <[hidden email]>
To: Pharo Development List <[hidden email]>
Subject: Re: [Pharo-dev] [Zinc, ZnPercentEncoder] problem encoding
accents
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=utf-8

Leo,

Are you sure you understand what percent encoding is ?

Check the class comment of ZnPercentEncoding, it has links to a Wikipedia article.

Did you see ZnPercentEncoderTests ?

Anyway, I would think this is what you want to do:

ZnPercentEncoder new encode: 'Neuqu?n, Neuqu?n Province, Argentina'.

=> 'Neuqu%C3%A9n%2C%20Neuqu%C3%A9n%20Province%2C%20Argentina'

ZnPercentEncoder new decode: 'Neuqu%C3%A9n%2C%20Neuqu%C3%A9n%20Province%2C%20Argentina'. 

=> 'Neuqu?n, Neuqu?n Province, Argentina'

Seems to work fine, no ?

What problem do you have with ZnUrl ?

Sven

Reply | Threaded
Open this post in threaded view
|

Re: [Zinc, ZnPercentEncoder] problem encoding accents

Sven Van Caekenberghe-2
Leo,

I am sorry but you will have to be more specific and concrete. You are mixing lots of different things (encoding/decoding, form submit, JS - and there are details missing) - there are many places where you could have done something wrong.

Please try to isolate your problem with a concrete short piece of code that I can run. Something along the lines of ZnDefaultServerDelegate>>formTest[1|2|3]: maybe.

Sven

> On 22 Apr 2015, at 15:46, Leo <[hidden email]> wrote:
>
> Sven
>      I saw the tests and they works fine.
> The problem is on the field.
> I have a form with javascript that gets addresses from Google Maps, then the form is submitted to my Pharo-Zinc-App.
> When the form is submitted by Safari(OS X), Smalltalks receives the character with accent without encoding (no %).
> Continuing with the Neuquen example,   the 'accented e’ that should be  %C3%A9 is received as the raw character.
> With Firefox all works fine, the character is received with the correct encoding.
>
> So the problem is related to ‘decode:’
> In the research I  also saw that some accented characters could be received as one character encoded, for example the 'accented e’ could be also %E9.
>
> thanks
> Leo
>
>
>    
>
>
>> El 21/4/2015, a las 18:26, [hidden email] escribió:
>>
>> Date: Tue, 21 Apr 2015 22:59:52 +0200
>> From: Sven Van Caekenberghe <[hidden email]>
>> To: Pharo Development List <[hidden email]>
>> Subject: Re: [Pharo-dev] [Zinc, ZnPercentEncoder] problem encoding
>> accents
>> Message-ID: <[hidden email]>
>> Content-Type: text/plain; charset=utf-8
>>
>> Leo,
>>
>> Are you sure you understand what percent encoding is ?
>>
>> Check the class comment of ZnPercentEncoding, it has links to a Wikipedia article.
>>
>> Did you see ZnPercentEncoderTests ?
>>
>> Anyway, I would think this is what you want to do:
>>
>> ZnPercentEncoder new encode: 'Neuqu?n, Neuqu?n Province, Argentina'.
>>
>> => 'Neuqu%C3%A9n%2C%20Neuqu%C3%A9n%20Province%2C%20Argentina'
>>
>> ZnPercentEncoder new decode: 'Neuqu%C3%A9n%2C%20Neuqu%C3%A9n%20Province%2C%20Argentina'.
>>
>> => 'Neuqu?n, Neuqu?n Province, Argentina'
>>
>> Seems to work fine, no ?
>>
>> What problem do you have with ZnUrl ?
>>
>> Sven
>