AIDA URL resolution patch

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

AIDA URL resolution patch

Masashi UMEZAWA-2
Hello Janko and all,

I've started playing around with AIDA/Web. I was quite impressed that
it can handle m17n string quite well! I was able to confirm Japanese string
is displayed and submitted without any changes to AIDA.

However, I found a little problem in multibyte URL resolution.

In HTTPRequest>>uriString, it returns request uri "as is", so it is
not encoded as Smalltalk internal m17n string. I think it is OK in Swazoo
level.

But AIDASite>>objectTo:forSession: uses the raw string for resolving object,
It fails because urlResolver's dictionary's keys are Smalltalk string.

I think it should be converted as Smalltalk internal m17n string.
Please see the attached file.

P.S.
I 've also found some methods that should be fixed.
(Maybe you have noticed them, but just FYI).

AIDASite class>>default. (there are some senders. But method is not
implemented).
AIDASite backupToFile. (In Squeak, there is no BOSS)
AIDASite restoreSiteNamed: (In Squeak, there is no BOSS)

Thanks again for releasing this great web app server.

Cheers,
---
[:masashi | ^umezawa]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

AIDASite-objectToforSession.st (922 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: AIDA URL resolution patch

Janko Mivšek
Hi Masashi,

Nice to hear that Japanese works well on Aida! And yes, if we like
mention that Aida has nice looking Urls, they must be nice in all
languages! I admit that here we are a bit lazy, in my country for
instance we just downgrade our writings to ASCII. Due to inertia
probably, because no long ago that was the only possibility.

Your patch is a right way to go, but maybe I'd put it in URLResolver
instead. I'll try this by myself and test with our characters.

Few words about encodings in Aida: on the web Aida uses UTF-8 encoding
only while internally all strings must be Unicode. That means in Squeak
Byte/WideStrings, on VW Byte/TwoByte/FourByteStrings. Keep in mind that
we never preserves strings in UTF-8 internally.

But with your patch you actually made Aida with Japanese Urls, did you
try that already?

Best regards
JAnko

Masashi UMEZAWA wrote:

> Hello Janko and all,
>
> I've started playing around with AIDA/Web. I was quite impressed that
> it can handle m17n string quite well! I was able to confirm Japanese string
> is displayed and submitted without any changes to AIDA.
>
> However, I found a little problem in multibyte URL resolution.
>
> In HTTPRequest>>uriString, it returns request uri "as is", so it is
> not encoded as Smalltalk internal m17n string. I think it is OK in Swazoo
> level.
>
> But AIDASite>>objectTo:forSession: uses the raw string for resolving object,
> It fails because urlResolver's dictionary's keys are Smalltalk string.
>
> I think it should be converted as Smalltalk internal m17n string.
> Please see the attached file.
>
> P.S.
> I 've also found some methods that should be fixed.
> (Maybe you have noticed them, but just FYI).
>
> AIDASite class>>default. (there are some senders. But method is not
> implemented).
> AIDASite backupToFile. (In Squeak, there is no BOSS)
> AIDASite restoreSiteNamed: (In Squeak, there is no BOSS)
>
> Thanks again for releasing this great web app server.
>
> Cheers,
> ---
> [:masashi | ^umezawa]
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: AIDA URL resolution patch

Masashi UMEZAWA-2
Hi Janko,

Thanks for looking into my patch.
I've tested the patch in Japanese included URLs, and it worked fine in
both IE and Firefox.

I will try your fix in Japanese URLs and do more tests.

Cheers,

2008/1/14, Janko Mivšek <[hidden email]>:

> Hi Masashi,
>
> Nice to hear that Japanese works well on Aida! And yes, if we like
> mention that Aida has nice looking Urls, they must be nice in all
> languages! I admit that here we are a bit lazy, in my country for
> instance we just downgrade our writings to ASCII. Due to inertia
> probably, because no long ago that was the only possibility.
>
> Your patch is a right way to go, but maybe I'd put it in URLResolver
> instead. I'll try this by myself and test with our characters.
>
> Few words about encodings in Aida: on the web Aida uses UTF-8 encoding
> only while internally all strings must be Unicode. That means in Squeak
> Byte/WideStrings, on VW Byte/TwoByte/FourByteStrings. Keep in mind that
> we never preserves strings in UTF-8 internally.
>
> But with your patch you actually made Aida with Japanese Urls, did you
> try that already?
>
> Best regards
> JAnko
>
> Masashi UMEZAWA wrote:
> > Hello Janko and all,
> >
> > I've started playing around with AIDA/Web. I was quite impressed that
> > it can handle m17n string quite well! I was able to confirm Japanese string
> > is displayed and submitted without any changes to AIDA.
> >
> > However, I found a little problem in multibyte URL resolution.
> >
> > In HTTPRequest>>uriString, it returns request uri "as is", so it is
> > not encoded as Smalltalk internal m17n string. I think it is OK in Swazoo
> > level.
> >
> > But AIDASite>>objectTo:forSession: uses the raw string for resolving object,
> > It fails because urlResolver's dictionary's keys are Smalltalk string.
> >
> > I think it should be converted as Smalltalk internal m17n string.
> > Please see the attached file.
> >
> > P.S.
> > I 've also found some methods that should be fixed.
> > (Maybe you have noticed them, but just FYI).
> >
> > AIDASite class>>default. (there are some senders. But method is not
> > implemented).
> > AIDASite backupToFile. (In Squeak, there is no BOSS)
> > AIDASite restoreSiteNamed: (In Squeak, there is no BOSS)
> >
> > Thanks again for releasing this great web app server.
> >
> > Cheers,
> > ---
> > [:masashi | ^umezawa]

--
[:masashi | ^umezawa]
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

International Urls (was URL resolution patch)

Janko Mivšek
It is interesting for me that Urls with non-ASCII letters just work,
without any special treatment. Isn't there some special standard for
that, IDNA?

        Here it is: http://www.ietf.org/rfc/rfc3490
        and http://en.wikipedia.org/wiki/Internationalized_domain_name


It seems that IDNA is for domain names only, while Urls are free to be
encoded UTF8? Masashi, if you have time, would you look at this question
a bit further?

Best regards
Janko

Masashi UMEZAWA wrote:

> Hi Janko,
>
> Thanks for looking into my patch.
> I've tested the patch in Japanese included URLs, and it worked fine in
> both IE and Firefox.
>
> I will try your fix in Japanese URLs and do more tests.
>
> Cheers,
>
> 2008/1/14, Janko Mivšek <[hidden email]>:
>> Hi Masashi,
>>
>> Nice to hear that Japanese works well on Aida! And yes, if we like
>> mention that Aida has nice looking Urls, they must be nice in all
>> languages! I admit that here we are a bit lazy, in my country for
>> instance we just downgrade our writings to ASCII. Due to inertia
>> probably, because no long ago that was the only possibility.
>>
>> Your patch is a right way to go, but maybe I'd put it in URLResolver
>> instead. I'll try this by myself and test with our characters.
>>
>> Few words about encodings in Aida: on the web Aida uses UTF-8 encoding
>> only while internally all strings must be Unicode. That means in Squeak
>> Byte/WideStrings, on VW Byte/TwoByte/FourByteStrings. Keep in mind that
>> we never preserves strings in UTF-8 internally.
>>
>> But with your patch you actually made Aida with Japanese Urls, did you
>> try that already?
>>
>> Best regards
>> JAnko
>>
>> Masashi UMEZAWA wrote:
>>> Hello Janko and all,
>>>
>>> I've started playing around with AIDA/Web. I was quite impressed that
>>> it can handle m17n string quite well! I was able to confirm Japanese string
>>> is displayed and submitted without any changes to AIDA.
>>>
>>> However, I found a little problem in multibyte URL resolution.
>>>
>>> In HTTPRequest>>uriString, it returns request uri "as is", so it is
>>> not encoded as Smalltalk internal m17n string. I think it is OK in Swazoo
>>> level.
>>>
>>> But AIDASite>>objectTo:forSession: uses the raw string for resolving object,
>>> It fails because urlResolver's dictionary's keys are Smalltalk string.
>>>
>>> I think it should be converted as Smalltalk internal m17n string.
>>> Please see the attached file.
>>>
>>> P.S.
>>> I 've also found some methods that should be fixed.
>>> (Maybe you have noticed them, but just FYI).
>>>
>>> AIDASite class>>default. (there are some senders. But method is not
>>> implemented).
>>> AIDASite backupToFile. (In Squeak, there is no BOSS)
>>> AIDASite restoreSiteNamed: (In Squeak, there is no BOSS)
>>>
>>> Thanks again for releasing this great web app server.
>>>
>>> Cheers,
>>> ---
>>> [:masashi | ^umezawa]
>

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: International Urls (was URL resolution patch)

Stefan Schmiedl
Janko Mivšek (2008-01-14 13:38):

> It is interesting for me that Urls with non-ASCII letters just work,
> without any special treatment. Isn't there some special standard for
> that, IDNA?
>
> Here it is: http://www.ietf.org/rfc/rfc3490
> and http://en.wikipedia.org/wiki/Internationalized_domain_name
>
>
> It seems that IDNA is for domain names only, while Urls are free to be
> encoded UTF8? Masashi, if you have time, would you look at this question
> a bit further?

According to http://www.w3.org/International/O-URL-code.html:

For worldwide interoperability, URIs have to be encoded uniformly. To
map the wide range of characters used worldwide into the 60 or so
allowed characters in a URI, a two-step process is used:

    * Convert the character string into a sequence of bytes using the
      UTF-8 encoding
    * Convert each byte that is not an ASCII letter or digit to %HH,
      where HH is the hexadecimal value of the byte

HTH
s.
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: International Urls (was URL resolution patch)

Masashi UMEZAWA-2
Hi all,

> According to http://www.w3.org/International/O-URL-code.html:
>
> For worldwide interoperability, URIs have to be encoded uniformly. To
> map the wide range of characters used worldwide into the 60 or so
> allowed characters in a URI, a two-step process is used:
>
>     * Convert the character string into a sequence of bytes using the
>       UTF-8 encoding
>     * Convert each byte that is not an ASCII letter or digit to %HH,
>       where HH is the hexadecimal value of the byte

Yes. This type of encoding is automatically done via web browser (IE
and Firefox at least).

In my investigation:
1. In SwazooURI>>fromString: receives URI encoded string (like
'/%E3%83%87%E3%83%A2.html').
2. The string is converted to Smalltalk byte string via
HTTPString>>decodedHTTPFrom:.
3. But the string is only byte string, so it should be converted to
m17n string by AIDASite level (maybe seeing codePage).

Cheers,
--
[:masashi | ^umezawa]
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: International Urls (was URL resolution patch)

Janko Mivšek
Masashi UMEZAWA wrote:

>> According to http://www.w3.org/International/O-URL-code.html:
>>
>> For worldwide interoperability, URIs have to be encoded uniformly. To
>> map the wide range of characters used worldwide into the 60 or so
>> allowed characters in a URI, a two-step process is used:
>>
>>     * Convert the character string into a sequence of bytes using the
>>       UTF-8 encoding
>>     * Convert each byte that is not an ASCII letter or digit to %HH,
>>       where HH is the hexadecimal value of the byte
>
> Yes. This type of encoding is automatically done via web browser (IE
> and Firefox at least).
>
> In my investigation:
> 1. In SwazooURI>>fromString: receives URI encoded string (like
> '/%E3%83%87%E3%83%A2.html').
> 2. The string is converted to Smalltalk byte string via
> HTTPString>>decodedHTTPFrom:.
> 3. But the string is only byte string, so it should be converted to
> m17n string by AIDASite level (maybe seeing codePage).

So Url resolution already works correctly in direction international
url>domain object. But what about reverse direction, object>url?

As you know the Url resolution in Aida is two way, one from url to
domain object, another from object to url. Second one is needed for
auto-url generation on web pages with just pointing to domain object
(#addLinkTo: anObject). And if domain object implements method
#preferedUrl, you can suggest Url here. Obviously you can suggest
international one too, but I'm not yet sure if this works. So Masashi
please try this too.

Janko



--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: International Urls (was URL resolution patch)

Masashi UMEZAWA-2
Hi Janko,

> As you know the Url resolution in Aida is two way, one from url to
> domain object, another from object to url. Second one is needed for
> auto-url generation on web pages with just pointing to domain object
> (#addLinkTo: anObject). And if domain object implements method
> #preferedUrl, you can suggest Url here. Obviously you can suggest
> international one too, but I'm not yet sure if this works. So Masashi
> please try this too.

Greatly, it just works. I've tested domain object links by "Address
Book" example.
(Please see the attached file).

It is quite understandable because AIDASite class >>convertToWeb:on:
is called for generating href stirng (Smalltalk m17n string is
converted to UTF-8 encoded string). Since the returned html includes
content type header, (="text/html; charset=UTF-8"), web browser can
interpret the the string as UTF-8. When the link is clicked, the
browser encode the href string to URI encoded one. (And AIDA decode it
for further processing...)

Cheers,
--
[:masashi | ^umezawa]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

AIDA-JaTest.jpg (96K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: International Urls (was URL resolution patch)

Janko Mivšek
Masashi, so we can conclude that international Urls are now supported
fully in Aida. Good work! So let me start using them by myself too :)

Janko

Masashi UMEZAWA wrote:

>> As you know the Url resolution in Aida is two way, one from url to
>> domain object, another from object to url. Second one is needed for
>> auto-url generation on web pages with just pointing to domain object
>> (#addLinkTo: anObject). And if domain object implements method
>> #preferedUrl, you can suggest Url here. Obviously you can suggest
>> international one too, but I'm not yet sure if this works. So Masashi
>> please try this too.
>
> Greatly, it just works. I've tested domain object links by "Address
> Book" example.
> (Please see the attached file).
>
> It is quite understandable because AIDASite class >>convertToWeb:on:
> is called for generating href stirng (Smalltalk m17n string is
> converted to UTF-8 encoded string). Since the returned html includes
> content type header, (="text/html; charset=UTF-8"), web browser can
> interpret the the string as UTF-8. When the link is clicked, the
> browser encode the href string to URI encoded one. (And AIDA decode it
> for further processing...)
>
> Cheers,
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida