WebClient and Unicode

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

WebClient and Unicode

Hannes Hirzel
On 2/1/13, Germán Arduino <[hidden email]> wrote:
> Thanks Hannes, this is very useful to me.
>
> My next step in porting stuff is polish WebClient and, between other
> things, Unicode is an issue.
>
> Germán.

Hello Germán

May I ask you to give some indication where Unicode is used in
WebClient. I'd like to have a look at it and focus on that for the
Unicoed porting layer.

Regards
Hannes

_______________________________________________
Cuis mailing list
[hidden email]
http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
Reply | Threaded
Open this post in threaded view
|

Re: WebClient and Unicode

garduino
Hi Hannes:

I was just responding the other mail where you mentioned me.

Some methods where WebClient call UTF8TextConverter or squeakToUtf8 are:

WebRequest >>send200Response:
WebRequest >>send400Response
WebRequest >>send404Response:
WebRequest >>send500Response:
WebSocket00>>send:type:
WebSocket07>>firstFragment:
Websocket07>>lastFragment:
Websocket07>>nextFragment:
WebSocket07>>send:
WebClientServerTests>>testStrings

Cheers.
Germán.

2013/2/5 H. Hirzel <[hidden email]>:

> On 2/1/13, Germán Arduino <[hidden email]> wrote:
>> Thanks Hannes, this is very useful to me.
>>
>> My next step in porting stuff is polish WebClient and, between other
>> things, Unicode is an issue.
>>
>> Germán.
>
> Hello Germán
>
> May I ask you to give some indication where Unicode is used in
> WebClient. I'd like to have a look at it and focus on that for the
> Unicoed porting layer.
>
> Regards
> Hannes
>
> _______________________________________________
> Cuis mailing list
> [hidden email]
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org

_______________________________________________
Cuis mailing list
[hidden email]
http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
Reply | Threaded
Open this post in threaded view
|

Re: WebClient and Unicode

Hannes Hirzel
Thank you for the list. This makes things easier. So easy things first:

In

send400Response
        "Send a 400 bad request response"

        | message |
        message := '<html><head><title>400 Bad Request</title></head><body>',
                '<h1>Bad Request</h1>
                <p>The server encountered a request it did not understand.
                </body></html>'.
       
        self sendResponseCode: 400
                content: message squeakToUtf8
                type: 'text/plain; charset=utf-8'
                close: true



    message squeakToUtf8
can safely be replaced with

   message


No call to #squeakToUtf8. The message is an ASCII only string and
ASCII is compatible with UTF8. I.e. every ASCII file (lower ASCII, up
to code 127) is automatically a UFT8 file.

--Hannes

On 2/5/13, Germán Arduino <[hidden email]> wrote:

> Hi Hannes:
>
> I was just responding the other mail where you mentioned me.
>
> Some methods where WebClient call UTF8TextConverter or squeakToUtf8 are:
>
> WebRequest >>send200Response:
> WebRequest >>send400Response
> WebRequest >>send404Response:
> WebRequest >>send500Response:
> WebSocket00>>send:type:
> WebSocket07>>firstFragment:
> Websocket07>>lastFragment:
> Websocket07>>nextFragment:
> WebSocket07>>send:
> WebClientServerTests>>testStrings
>
> Cheers.
> Germán.
>
> 2013/2/5 H. Hirzel <[hidden email]>:
>> On 2/1/13, Germán Arduino <[hidden email]> wrote:
>>> Thanks Hannes, this is very useful to me.
>>>
>>> My next step in porting stuff is polish WebClient and, between other
>>> things, Unicode is an issue.
>>>
>>> Germán.
>>
>> Hello Germán
>>
>> May I ask you to give some indication where Unicode is used in
>> WebClient. I'd like to have a look at it and focus on that for the
>> Unicoed porting layer.
>>
>> Regards
>> Hannes
>>
>> _______________________________________________
>> Cuis mailing list
>> [hidden email]
>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>
> _______________________________________________
> Cuis mailing list
> [hidden email]
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>

_______________________________________________
Cuis mailing list
[hidden email]
http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
Reply | Threaded
Open this post in threaded view
|

Re: WebClient and Unicode

Hannes Hirzel
Further analysis shows that all the eight cases can be reduced to one
of the two calls


    aString squeakToUtf8
   aString convertToWithConverter: UTF8TextConverter new


So the next step is to check
how this is implemented in Squeak.

--HJH

On 2/5/13, H. Hirzel <[hidden email]> wrote:

> Thank you for the list. This makes things easier. So easy things first:
>
> In
>
> send400Response
> "Send a 400 bad request response"
>
> | message |
> message := '<html><head><title>400 Bad Request</title></head><body>',
> '<h1>Bad Request</h1>
> <p>The server encountered a request it did not understand.
> </body></html>'.
>
> self sendResponseCode: 400
> content: message squeakToUtf8
> type: 'text/plain; charset=utf-8'
> close: true
>
>
>
>     message squeakToUtf8
> can safely be replaced with
>
>    message
>
>
> No call to #squeakToUtf8. The message is an ASCII only string and
> ASCII is compatible with UTF8. I.e. every ASCII file (lower ASCII, up
> to code 127) is automatically a UFT8 file.
>
> --Hannes
>
> On 2/5/13, Germán Arduino <[hidden email]> wrote:
>> Hi Hannes:
>>
>> I was just responding the other mail where you mentioned me.
>>
>> Some methods where WebClient call UTF8TextConverter or squeakToUtf8 are:
>>
>> WebRequest >>send200Response:
>> WebRequest >>send400Response
>> WebRequest >>send404Response:
>> WebRequest >>send500Response:
>> WebSocket00>>send:type:
>> WebSocket07>>firstFragment:
>> Websocket07>>lastFragment:
>> Websocket07>>nextFragment:
>> WebSocket07>>send:
>> WebClientServerTests>>testStrings
>>
>> Cheers.
>> Germán.
>>
>> 2013/2/5 H. Hirzel <[hidden email]>:
>>> On 2/1/13, Germán Arduino <[hidden email]> wrote:
>>>> Thanks Hannes, this is very useful to me.
>>>>
>>>> My next step in porting stuff is polish WebClient and, between other
>>>> things, Unicode is an issue.
>>>>
>>>> Germán.
>>>
>>> Hello Germán
>>>
>>> May I ask you to give some indication where Unicode is used in
>>> WebClient. I'd like to have a look at it and focus on that for the
>>> Unicoed porting layer.
>>>
>>> Regards
>>> Hannes
>>>
>>> _______________________________________________
>>> Cuis mailing list
>>> [hidden email]
>>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>
>> _______________________________________________
>> Cuis mailing list
>> [hidden email]
>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>
>

_______________________________________________
Cuis mailing list
[hidden email]
http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
Reply | Threaded
Open this post in threaded view
|

Re: WebClient and Unicode

Hannes Hirzel
For the method
squeakToUtf8
        "Convert the given string (self) to UTF-8 from Squeak's internal
representation."

        ^UTF8TextConverter encodeByteString: self


We have a direct Cuis replacement

        #iso8859s15ToUtf8

I wonder if this is a relict of an earlier version of Squeak for which
WebClient was written for.

The Squeak class comment for Character says

"I represent a character by storing its associated Unicode. The first
256 characters are created uniquely, so that all instances of latin1
characters ($R, for example) are identical.

        The code point is based on Unicode. "

--HJH


On 2/5/13, H. Hirzel <[hidden email]> wrote:

> Further analysis shows that all the eight cases can be reduced to one
> of the two calls
>
>
>     aString squeakToUtf8
>    aString convertToWithConverter: UTF8TextConverter new
>
>
> So the next step is to check
> how this is implemented in Squeak.
>
> --HJH
>
> On 2/5/13, H. Hirzel <[hidden email]> wrote:
>> Thank you for the list. This makes things easier. So easy things first:
>>
>> In
>>
>> send400Response
>> "Send a 400 bad request response"
>>
>> | message |
>> message := '<html><head><title>400 Bad Request</title></head><body>',
>> '<h1>Bad Request</h1>
>> <p>The server encountered a request it did not understand.
>> </body></html>'.
>>
>> self sendResponseCode: 400
>> content: message squeakToUtf8
>> type: 'text/plain; charset=utf-8'
>> close: true
>>
>>
>>
>>     message squeakToUtf8
>> can safely be replaced with
>>
>>    message
>>
>>
>> No call to #squeakToUtf8. The message is an ASCII only string and
>> ASCII is compatible with UTF8. I.e. every ASCII file (lower ASCII, up
>> to code 127) is automatically a UFT8 file.
>>
>> --Hannes
>>
>> On 2/5/13, Germán Arduino <[hidden email]> wrote:
>>> Hi Hannes:
>>>
>>> I was just responding the other mail where you mentioned me.
>>>
>>> Some methods where WebClient call UTF8TextConverter or squeakToUtf8 are:
>>>
>>> WebRequest >>send200Response:
>>> WebRequest >>send400Response
>>> WebRequest >>send404Response:
>>> WebRequest >>send500Response:
>>> WebSocket00>>send:type:
>>> WebSocket07>>firstFragment:
>>> Websocket07>>lastFragment:
>>> Websocket07>>nextFragment:
>>> WebSocket07>>send:
>>> WebClientServerTests>>testStrings
>>>
>>> Cheers.
>>> Germán.
>>>
>>> 2013/2/5 H. Hirzel <[hidden email]>:
>>>> On 2/1/13, Germán Arduino <[hidden email]> wrote:
>>>>> Thanks Hannes, this is very useful to me.
>>>>>
>>>>> My next step in porting stuff is polish WebClient and, between other
>>>>> things, Unicode is an issue.
>>>>>
>>>>> Germán.
>>>>
>>>> Hello Germán
>>>>
>>>> May I ask you to give some indication where Unicode is used in
>>>> WebClient. I'd like to have a look at it and focus on that for the
>>>> Unicoed porting layer.
>>>>
>>>> Regards
>>>> Hannes
>>>>
>>>> _______________________________________________
>>>> Cuis mailing list
>>>> [hidden email]
>>>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>>
>>> _______________________________________________
>>> Cuis mailing list
>>> [hidden email]
>>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>>
>>
>

_______________________________________________
Cuis mailing list
[hidden email]
http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org