[Cuis] WebClient and Unicode

H. Hirzel hannes.hirzel at gmail.com
Tue Feb 5 11:23:51 CST 2013


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 <hannes.hirzel at gmail.com> 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 <hannes.hirzel at gmail.com> 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 <garduino at gmail.com> 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 <hannes.hirzel at gmail.com>:
>>>> On 2/1/13, Germán Arduino <garduino at gmail.com> 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
>>>> Cuis at jvuletich.org
>>>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>>
>>> _______________________________________________
>>> Cuis mailing list
>>> Cuis at jvuletich.org
>>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>>
>>
>




More information about the Cuis mailing list