Encoding question

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

Encoding question

Andres Fortier-2
Hi list,
            maybe I'm wrong, but it seems that Seaside is not able to
render accented characters (like 'á,é,í...' etc) and other spacial
cases. I've been looking around and ended up in the WAHtmlEncoder
class, which redefines #encode:on: for just a few cases, not for all
the special character in range 0..255. Am I right here? Is there a
standard extension for this?

--
Thanks,
             Andrés
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Encoding question

Sebastian Sastre-2
This is a FAQ. Try starting with WAKomEncoded instead of WAKom

Sebastian Sastre



> -----Mensaje original-----
> De: [hidden email]
> [mailto:[hidden email]] En nombre
> de Andres Fortier
> Enviado el: Martes, 03 de Junio de 2008 15:32
> Para: Seaside List
> Asunto: [Seaside] Encoding question
>
> Hi list,
>             maybe I'm wrong, but it seems that Seaside is not able to
> render accented characters (like 'á,é,í...' etc) and other spacial
> cases. I've been looking around and ended up in the WAHtmlEncoder
> class, which redefines #encode:on: for just a few cases, not for all
> the special character in range 0..255. Am I right here? Is there a
> standard extension for this?
>
> --
> Thanks,
>              Andrés
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Philippe Marschall
Ce n'est pas si facile que ça. Tell us what encoding you have on your
web page, in your image, your Seasie, Kom, Squeak (assuming you're on
Squeak) version and we tell you what to do.

And oh, check the class comments of WAKom and WAKomEncoded.

Cheers
Philippe

2008/6/3, Sebastian Sastre <[hidden email]>:

> This is a FAQ. Try starting with WAKomEncoded instead of WAKom
>
>  Sebastian Sastre
>
>
>
>  > -----Mensaje original-----
>  > De: [hidden email]
>  > [mailto:[hidden email]] En nombre
>  > de Andres Fortier
>  > Enviado el: Martes, 03 de Junio de 2008 15:32
>  > Para: Seaside List
>  > Asunto: [Seaside] Encoding question
>
> >
>  > Hi list,
>  >             maybe I'm wrong, but it seems that Seaside is not able to
>  > render accented characters (like 'á,é,í...' etc) and other spacial
>  > cases. I've been looking around and ended up in the WAHtmlEncoder
>  > class, which redefines #encode:on: for just a few cases, not for all
>  > the special character in range 0..255. Am I right here? Is there a
>  > standard extension for this?
>  >
>  > --
>  > Thanks,
>  >              Andrés
>  > _______________________________________________
>  > seaside mailing list
>  > [hidden email]
>  > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>  _______________________________________________
>  seaside mailing list
>  [hidden email]
>  http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Andres Fortier-2
In reply to this post by Sebastian Sastre-2
Hi Sebastian, thanks for the response! I guess I must be missing
something, but I can't seem to find the FAQ related to this issue :(.
  Regarding WAKomEncoded and WAKom, they are Squeak classes, right?
Because I'm using VW :(.

Thanks again,
                      Andrés

Sebastian Sastre escribió:

> This is a FAQ. Try starting with WAKomEncoded instead of WAKom
>
> Sebastian Sastre
>
>
>
>> -----Mensaje original-----
>> De: [hidden email]
>> [mailto:[hidden email]] En nombre
>> de Andres Fortier
>> Enviado el: Martes, 03 de Junio de 2008 15:32
>> Para: Seaside List
>> Asunto: [Seaside] Encoding question
>>
>> Hi list,
>>             maybe I'm wrong, but it seems that Seaside is not able to
>> render accented characters (like 'á,é,í...' etc) and other spacial
>> cases. I've been looking around and ended up in the WAHtmlEncoder
>> class, which redefines #encode:on: for just a few cases, not for all
>> the special character in range 0..255. Am I right here? Is there a
>> standard extension for this?
>>
>> --
>> Thanks,
>>              Andrés
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Andres Fortier-2
In reply to this post by Philippe Marschall
Hi Sebastian, Philippe:
                                  sorry for the short description: I'm using seaside in VW
7.4.1 (actually Swazoo + Seaside). Encoding is UTF-8 in the VW image.
Now, I guess I must be wrong in this, but isn't WAHtmlEncoder supposed
to do the conversion between special characters and html entities? I
found kind of weird the standard implementation of #encode:on: since
it makes you think that this is the purpose of this class. So I guess
I should rephrase my question: what is WAHtmlEncoder supposed to do?
Who should be in charge of translating the html entities? The web server?

Thanks!
Andrés

Philippe Marschall escribió:

> Ce n'est pas si facile que ça. Tell us what encoding you have on your
> web page, in your image, your Seasie, Kom, Squeak (assuming you're on
> Squeak) version and we tell you what to do.
>
> And oh, check the class comments of WAKom and WAKomEncoded.
>
> Cheers
> Philippe
>
> 2008/6/3, Sebastian Sastre <[hidden email]>:
>> This is a FAQ. Try starting with WAKomEncoded instead of WAKom
>>
>>  Sebastian Sastre
>>
>>
>>
>>  > -----Mensaje original-----
>>  > De: [hidden email]
>>  > [mailto:[hidden email]] En nombre
>>  > de Andres Fortier
>>  > Enviado el: Martes, 03 de Junio de 2008 15:32
>>  > Para: Seaside List
>>  > Asunto: [Seaside] Encoding question
>>
>>  > Hi list,
>>  >             maybe I'm wrong, but it seems that Seaside is not able to
>>  > render accented characters (like 'á,é,í...' etc) and other spacial
>>  > cases. I've been looking around and ended up in the WAHtmlEncoder
>>  > class, which redefines #encode:on: for just a few cases, not for all
>>  > the special character in range 0..255. Am I right here? Is there a
>>  > standard extension for this?
>>  >
>>  > --
>>  > Thanks,
>>  >              Andrés
>>  > _______________________________________________
>>  > seaside mailing list
>>  > [hidden email]
>>  > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>>  _______________________________________________
>>  seaside mailing list
>>  [hidden email]
>>  http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Encoding question

Boris Popov, DeepCove Labs (SNN)
Andres,

I recall getting that same combo working a while back, here's a starting point for you,

SeasidePlatformSupport class>>readWriteStream
 ^EncodedStream
   on: (ReadWriteStream on: (ByteArray new: 1000))
   encodedBy: (StreamEncoder new: #'utf-8').

... but I think I had to make a couple of small changes to Swazoo as well, although I don't have that code handy anymore.

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: [hidden email] [mailto:seaside-
> [hidden email]] On Behalf Of Andres Fortier
> Sent: Tuesday, June 03, 2008 12:34 PM
> To: Seaside - general discussion
> Subject: Re: [Seaside] Encoding question
>
> Hi Sebastian, Philippe:
>          sorry for the short description: I'm using
> seaside in VW
> 7.4.1 (actually Swazoo + Seaside). Encoding is UTF-8 in the VW image.
> Now, I guess I must be wrong in this, but isn't WAHtmlEncoder supposed
> to do the conversion between special characters and html entities? I
> found kind of weird the standard implementation of #encode:on: since
> it makes you think that this is the purpose of this class. So I guess
> I should rephrase my question: what is WAHtmlEncoder supposed to do?
> Who should be in charge of translating the html entities? The web server?
>
> Thanks!
> Andrés
>
> Philippe Marschall escribió:
> > Ce n'est pas si facile que ça. Tell us what encoding you have on your
> > web page, in your image, your Seasie, Kom, Squeak (assuming you're on
> > Squeak) version and we tell you what to do.
> >
> > And oh, check the class comments of WAKom and WAKomEncoded.
> >
> > Cheers
> > Philippe
> >
> > 2008/6/3, Sebastian Sastre <[hidden email]>:
> >> This is a FAQ. Try starting with WAKomEncoded instead of WAKom
> >>
> >>  Sebastian Sastre
> >>
> >>
> >>
> >>  > -----Mensaje original-----
> >>  > De: [hidden email]
> >>  > [mailto:[hidden email]] En nombre
> >>  > de Andres Fortier
> >>  > Enviado el: Martes, 03 de Junio de 2008 15:32
> >>  > Para: Seaside List
> >>  > Asunto: [Seaside] Encoding question
> >>
> >>  > Hi list,
> >>  >             maybe I'm wrong, but it seems that Seaside is not able
> to
> >>  > render accented characters (like 'á,é,í...' etc) and other spacial
> >>  > cases. I've been looking around and ended up in the WAHtmlEncoder
> >>  > class, which redefines #encode:on: for just a few cases, not for all
> >>  > the special character in range 0..255. Am I right here? Is there a
> >>  > standard extension for this?
> >>  >
> >>  > --
> >>  > Thanks,
> >>  >              Andrés
> >>  > _______________________________________________
> >>  > seaside mailing list
> >>  > [hidden email]
> >>  > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >>
> >>  _______________________________________________
> >>  seaside mailing list
> >>  [hidden email]
> >>  http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >>
> >>
> >> -----------------------------------------------------------------------
> -
> >>
> >> _______________________________________________
> >> seaside mailing list
> >> [hidden email]
> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Philippe Marschall
That's quite a hack, I expect it to break if you return any binary
content (images, pdfs, ...). Second the image encoding won't be utf-8.

Cheers
Philippe

2008/6/3, Boris Popov <[hidden email]>:

> Andres,
>
>  I recall getting that same combo working a while back, here's a starting point for you,
>
>  SeasidePlatformSupport class>>readWriteStream
>   ^EncodedStream
>    on: (ReadWriteStream on: (ByteArray new: 1000))
>    encodedBy: (StreamEncoder new: #'utf-8').
>
>  ... but I think I had to make a couple of small changes to Swazoo as well, although I don't have that code handy anymore.
>
>  -Boris
>
>  --
>  +1.604.689.0322
>  DeepCove Labs Ltd.
>  4th floor 595 Howe Street
>  Vancouver, Canada V6C 2T5
>  http://tinyurl.com/r7uw4
>
>  [hidden email]
>
>  CONFIDENTIALITY NOTICE
>
>  This email is intended only for the persons named in the message
>  header. Unless otherwise indicated, it contains information that is
>  private and confidential. If you have received it in error, please
>  notify the sender and delete the entire message including any
>  attachments.
>
>  Thank you.
>
>
>  > -----Original Message-----
>  > From: [hidden email] [mailto:seaside-
>  > [hidden email]] On Behalf Of Andres Fortier
>  > Sent: Tuesday, June 03, 2008 12:34 PM
>  > To: Seaside - general discussion
>  > Subject: Re: [Seaside] Encoding question
>  >
>  > Hi Sebastian, Philippe:
>  >                                 sorry for the short description: I'm using
>  > seaside in VW
>  > 7.4.1 (actually Swazoo + Seaside). Encoding is UTF-8 in the VW image.
>  > Now, I guess I must be wrong in this, but isn't WAHtmlEncoder supposed
>  > to do the conversion between special characters and html entities? I
>  > found kind of weird the standard implementation of #encode:on: since
>  > it makes you think that this is the purpose of this class. So I guess
>  > I should rephrase my question: what is WAHtmlEncoder supposed to do?
>  > Who should be in charge of translating the html entities? The web server?
>  >
>  > Thanks!
>  > Andrés
>  >
>  > Philippe Marschall escribió:
>  > > Ce n'est pas si facile que ça. Tell us what encoding you have on your
>  > > web page, in your image, your Seasie, Kom, Squeak (assuming you're on
>  > > Squeak) version and we tell you what to do.
>  > >
>  > > And oh, check the class comments of WAKom and WAKomEncoded.
>  > >
>  > > Cheers
>  > > Philippe
>  > >
>  > > 2008/6/3, Sebastian Sastre <[hidden email]>:
>  > >> This is a FAQ. Try starting with WAKomEncoded instead of WAKom
>  > >>
>  > >>  Sebastian Sastre
>  > >>
>  > >>
>  > >>
>  > >>  > -----Mensaje original-----
>  > >>  > De: [hidden email]
>  > >>  > [mailto:[hidden email]] En nombre
>  > >>  > de Andres Fortier
>  > >>  > Enviado el: Martes, 03 de Junio de 2008 15:32
>  > >>  > Para: Seaside List
>  > >>  > Asunto: [Seaside] Encoding question
>  > >>
>  > >>  > Hi list,
>  > >>  >             maybe I'm wrong, but it seems that Seaside is not able
>  > to
>  > >>  > render accented characters (like 'á,é,í...' etc) and other spacial
>  > >>  > cases. I've been looking around and ended up in the WAHtmlEncoder
>  > >>  > class, which redefines #encode:on: for just a few cases, not for all
>  > >>  > the special character in range 0..255. Am I right here? Is there a
>  > >>  > standard extension for this?
>  > >>  >
>  > >>  > --
>  > >>  > Thanks,
>  > >>  >              Andrés
>  > >>  > _______________________________________________
>  > >>  > seaside mailing list
>  > >>  > [hidden email]
>  > >>  > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  > >>
>  > >>  _______________________________________________
>  > >>  seaside mailing list
>  > >>  [hidden email]
>  > >>  http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  > >>
>  > >>
>  > >> -----------------------------------------------------------------------
>  > -
>  > >>
>  > >> _______________________________________________
>  > >> seaside mailing list
>  > >> [hidden email]
>  > >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  > _______________________________________________
>  > seaside mailing list
>  > [hidden email]
>  > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  _______________________________________________
>  seaside mailing list
>  [hidden email]
>  http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Philippe Marschall
In reply to this post by Andres Fortier-2
2008/6/3, Andres Fortier <[hidden email]>:
> Hi Sebastian, Philippe:
>                                   sorry for the short description: I'm using
> seaside in VW 7.4.1 (actually Swazoo + Seaside). Encoding is UTF-8 in the VW
> image.

Well that should work. Supposed you have Seaside 2.8, can you go to
/seaside/tests/alltests
(you probably need a go somewhere)
and run the encoding test?

> Now, I guess I must be wrong in this, but isn't WAHtmlEncoder
> supposed to do the conversion between special characters and html entities?
> I found kind of weird the standard implementation of #encode:on: since it
> makes you think that this is the purpose of this class. So I guess I should
> rephrase my question: what is WAHtmlEncoder supposed to do? Who should be in
> charge of translating the html entities? The web server?

No one, really. The only characters you need to escape are $" $< $&
and $> which is exactly what WAHtmlEncoder does. What the web server
is supposed to do is encode from characters to bytes. If your image
encoding is utf-8 then is a simply one to one mapping (given your page
encoding is utf-8 as well).

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Boris Popov, DeepCove Labs (SNN)
In reply to this post by Andres Fortier-2
Re: [Seaside] Encoding question

Philippe,

Which is where all the other hacks in the Swazoo came about, all worked just fine in until we moved to opentalk recently, but the old code is in the repository we left behind.

Cheers!

-Boris (via BlackBerry)

----- Original Message -----
From: [hidden email] <[hidden email]>
To: Seaside - general discussion <[hidden email]>
Sent: Tue Jun 03 21:38:53 2008
Subject: Re: [Seaside] Encoding question

That's quite a hack, I expect it to break if you return any binary
content (images, pdfs, ...). Second the image encoding won't be utf-8.

Cheers
Philippe

2008/6/3, Boris Popov <[hidden email]>:
> Andres,
>
>  I recall getting that same combo working a while back, here's a starting point for you,
>
>  SeasidePlatformSupport class>>readWriteStream
>   ^EncodedStream
>    on: (ReadWriteStream on: (ByteArray new: 1000))
>    encodedBy: (StreamEncoder new: #'utf-8').
>
>  ... but I think I had to make a couple of small changes to Swazoo as well, although I don't have that code handy anymore.
>
>  -Boris
>
>  --
>  +1.604.689.0322
>  DeepCove Labs Ltd.
>  4th floor 595 Howe Street
>  Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4
>
[hidden email]
>
>  CONFIDENTIALITY NOTICE
>
>  This email is intended only for the persons named in the message
>  header. Unless otherwise indicated, it contains information that is
>  private and confidential. If you have received it in error, please
>  notify the sender and delete the entire message including any
>  attachments.
>
>  Thank you.
>
>
>  > -----Original Message-----
>  > From: [hidden email] [[hidden email]
>  > [hidden email]] On Behalf Of Andres Fortier
>  > Sent: Tuesday, June 03, 2008 12:34 PM
>  > To: Seaside - general discussion
>  > Subject: Re: [Seaside] Encoding question
>  >
>  > Hi Sebastian, Philippe:
>  >                                 sorry for the short description: I'm using
>  > seaside in VW
>  > 7.4.1 (actually Swazoo + Seaside). Encoding is UTF-8 in the VW image.
>  > Now, I guess I must be wrong in this, but isn't WAHtmlEncoder supposed
>  > to do the conversion between special characters and html entities? I
>  > found kind of weird the standard implementation of #encode:on: since
>  > it makes you think that this is the purpose of this class. So I guess
>  > I should rephrase my question: what is WAHtmlEncoder supposed to do?
>  > Who should be in charge of translating the html entities? The web server?
>  >
>  > Thanks!
>  > Andrés
>  >
>  > Philippe Marschall escribió:
>  > > Ce n'est pas si facile que ça. Tell us what encoding you have on your
>  > > web page, in your image, your Seasie, Kom, Squeak (assuming you're on
>  > > Squeak) version and we tell you what to do.
>  > >
>  > > And oh, check the class comments of WAKom and WAKomEncoded.
>  > >
>  > > Cheers
>  > > Philippe
>  > >
>  > > 2008/6/3, Sebastian Sastre <[hidden email]>:
>  > >> This is a FAQ. Try starting with WAKomEncoded instead of WAKom
>  > >>
>  > >>  Sebastian Sastre
>  > >>
>  > >>
>  > >>
>  > >>  > -----Mensaje original-----
>  > >>  > De: [hidden email]
>  > >>  > [[hidden email]] En nombre
>  > >>  > de Andres Fortier
>  > >>  > Enviado el: Martes, 03 de Junio de 2008 15:32
>  > >>  > Para: Seaside List
>  > >>  > Asunto: [Seaside] Encoding question
>  > >>
>  > >>  > Hi list,
>  > >>  >             maybe I'm wrong, but it seems that Seaside is not able
>  > to
>  > >>  > render accented characters (like 'á,é,í...' etc) and other spacial
>  > >>  > cases. I've been looking around and ended up in the WAHtmlEncoder
>  > >>  > class, which redefines #encode:on: for just a few cases, not for all
>  > >>  > the special character in range 0..255. Am I right here? Is there a
>  > >>  > standard extension for this?
>  > >>  >
>  > >>  > --
>  > >>  > Thanks,
>  > >>  >              Andrés
>  > >>  > _______________________________________________
>  > >>  > seaside mailing list
>  > >>  > [hidden email]
>  > >>  > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  > >>
>  > >>  _______________________________________________
>  > >>  seaside mailing list
>  > >>  [hidden email]
>  > >>  http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  > >>
>  > >>
>  > >> -----------------------------------------------------------------------
>  > -
>  > >>
>  > >> _______________________________________________
>  > >> seaside mailing list
>  > >> [hidden email]
>  > >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  > _______________________________________________
>  > seaside mailing list
>  > [hidden email]
>  > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  _______________________________________________
>  seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Andres Fortier-2
In reply to this post by Philippe Marschall
Hi Philippe, sorry for not responding earlier. I guess there must be
some kind of mess in my image, since the encoding tests work ok.
However, if I inspect the 'urlencoded' iv when submitting the form, I
get a string with garbage. On the other hand, the streams are
EncodedStreams with a utf-8 encoder; however if I write a special
character (say 'é') in the browser, I can see it ok inside the image,
but it can't be rendered in the html page. Thus, there must be an
encoding mismatch somewhere, but I'm not able to find it. I guess I'll
be spending quite a while debugging this :(.

Thanks again for your help!

Andrés


Philippe Marschall escribió:

> 2008/6/3, Andres Fortier <[hidden email]>:
>> Hi Sebastian, Philippe:
>>                                   sorry for the short description: I'm using
>> seaside in VW 7.4.1 (actually Swazoo + Seaside). Encoding is UTF-8 in the VW
>> image.
>
> Well that should work. Supposed you have Seaside 2.8, can you go to
> /seaside/tests/alltests
> (you probably need a go somewhere)
> and run the encoding test?
>
>> Now, I guess I must be wrong in this, but isn't WAHtmlEncoder
>> supposed to do the conversion between special characters and html entities?
>> I found kind of weird the standard implementation of #encode:on: since it
>> makes you think that this is the purpose of this class. So I guess I should
>> rephrase my question: what is WAHtmlEncoder supposed to do? Who should be in
>> charge of translating the html entities? The web server?
>
> No one, really. The only characters you need to escape are $" $< $&
> and $> which is exactly what WAHtmlEncoder does. What the web server
> is supposed to do is encode from characters to bytes. If your image
> encoding is utf-8 then is a simply one to one mapping (given your page
> encoding is utf-8 as well).
>
> Cheers
> Philippe
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Philippe Marschall
In reply to this post by Boris Popov, DeepCove Labs (SNN)
2008/6/3, Boris Popov <[hidden email]>:

> Andres,
>
>  I recall getting that same combo working a while back, here's a starting point for you,
>
>  SeasidePlatformSupport class>>readWriteStream
>   ^EncodedStream
>    on: (ReadWriteStream on: (ByteArray new: 1000))
>    encodedBy: (StreamEncoder new: #'utf-8').
>
>  ... but I think I had to make a couple of small changes to Swazoo as well, although I don't have that code handy anymore.


Uhm, sometimes I am so blind. That does only half the work, that does
only do the encoding (unconditionally), you'll also need to do the
decoding.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Philippe Marschall
In reply to this post by Andres Fortier-2
2008/6/5, Andres Fortier <[hidden email]>:
> Hi Philippe, sorry for not responding earlier. I guess there must be some
> kind of mess in my image, since the encoding tests work ok. However, if I
> inspect the 'urlencoded' iv when submitting the form, I get a string with
> garbage. On the other hand, the streams are EncodedStreams with a utf-8
> encoder;

Wow, that is a massive change. Last time I asked you said the encoding
in your image would be utf-8, now you do utf-8 encoding. That does not
work together. I hope you don't use the patch Boris posted because I
don't see how this can work.

> however if I write a special character (say 'é') in the browser, I
> can see it ok inside the image, but it can't be rendered in the html page.
> Thus, there must be an encoding mismatch somewhere, but I'm not able to find
> it. I guess I'll be spending quite a while debugging this :(.

If the encoding in your image is utf-8 then the browser should send
0xC3 0xA9 (two bytes) and in your image you should have:

String with: (Character value: 16rC3) with: (Character value: 16rA9)

This should be sent unaltered to the browser.

If your image encoding is Unicode then browser your send 0xC3 0xA9 as
well and in your image you should have:

String with: (Character value: 16rE9)

This should be sent as 0xC3 0xA9  to the browser.

Happy debugging.

Cheers
Philippe

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Andres Fortier-2
[snip]
> If your image encoding is Unicode then browser your send 0xC3 0xA9 as
> well and in your image you should have:
>
> String with: (Character value: 16rE9)
>
> This should be sent as 0xC3 0xA9  to the browser.

That's what I supposed too, but it seems something is getting lost
somewhere.

> Happy debugging.

Thanks! :). As soon as I find the bug I'll post it here (however,
since this is a personal project, it may take a while).

Thanks for the help,
                                    Andrés
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Philippe Marschall
2008/6/6 Andres Fortier <[hidden email]>:

> [snip]
>>
>> If your image encoding is Unicode then browser your send 0xC3 0xA9 as
>> well and in your image you should have:
>>
>> String with: (Character value: 16rE9)
>>
>> This should be sent as 0xC3 0xA9  to the browser.
>
> That's what I supposed too, but it seems something is getting lost
> somewhere.

I can tell you where it should happen. When the String is written to
the WAResponse instance the stream instance variable should be an
EncodedStream that does the encoding. Some time later someone should
send #contents to the WAResponse instance it should return the encoded
string.

But that solves only the part for the response and not for the request.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Andres Fortier-2
Ok, thank you very much for the pointers!

Cheers,
              Andrés

Philippe Marschall escribió:

> 2008/6/6 Andres Fortier <[hidden email]>:
>> [snip]
>>> If your image encoding is Unicode then browser your send 0xC3 0xA9 as
>>> well and in your image you should have:
>>>
>>> String with: (Character value: 16rE9)
>>>
>>> This should be sent as 0xC3 0xA9  to the browser.
>> That's what I supposed too, but it seems something is getting lost
>> somewhere.
>
> I can tell you where it should happen. When the String is written to
> the WAResponse instance the stream instance variable should be an
> EncodedStream that does the encoding. Some time later someone should
> send #contents to the WAResponse instance it should return the encoded
> string.
>
> But that solves only the part for the response and not for the request.
>
> Cheers
> Philippe
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Encoding question

Lautaro Fernández
Hi Andrés, list,
I've found the "root" of problem.

If you look into the message "WAResponse(class)>>defaultValueForCharSet" you will see that always return 'UTF-8', but in my case, the VisualWorksNC image is encoding in  #'Windows-1252', so for that reason I couldn't see the accentuated characters properly.

The fix is to override "WAResponse(class)>>defaultValueForCharSet" as follow:
WAResponse(class)>>defaultValueForCharSet
    ^Locale current defaultEncoding "this will return the actual image's encoding"

Hope this helps,
Lautaro Fernández


2008/6/7 Andres Fortier <[hidden email]>:
Ok, thank you very much for the pointers!

Cheers,
            Andrés

Philippe Marschall escribió:

2008/6/6 Andres Fortier <[hidden email]>:
[snip]
If your image encoding is Unicode then browser your send 0xC3 0xA9 as
well and in your image you should have:

String with: (Character value: 16rE9)

This should be sent as 0xC3 0xA9  to the browser.
That's what I supposed too, but it seems something is getting lost
somewhere.

I can tell you where it should happen. When the String is written to
the WAResponse instance the stream instance variable should be an
EncodedStream that does the encoding. Some time later someone should
send #contents to the WAResponse instance it should return the encoded
string.

But that solves only the part for the response and not for the request.

Cheers
Philippe

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--
Luke LAut SkyFernadezWalker
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside