[Seaside] is there url encoding in Seaside or Squeak?

Merik Voswinkel merik at mac.com
Sat Sep 29 23:43:18 UTC 2007

>> I  have a string that I need to 'url encode' as specified in
>> RFC 1738 (see http://www.rfc-editor.org/rfc/rfc1738.txt )
>> Does anybody know of an existing method that already does that?
>> There is code in WAUrlEncoder and WAUrl but if I am correct
>> that has nothing to do with 'url encoding' as meant in RFC 1738.
>> Maybe there is some code that does a simple parse of a string
>> and replaces it with values from a table that I can use as a model?
>> An example of url encoding:
>> The url:   'xmlPath=http://localhost:9090/seaside/tests/facade?
>> 24&_k=QfTdFUeY&_s=FSxTGyuBNcNckyjq'
>> can be encoded as:  'xmlPath%3Dhttp%3A%2F%2Flocalhost%3A9090% 
>> 2Fseaside
>> %2Ftests%2Ffacade%3F24%26%5Fk%3DQfTdFUeY%26%5Fs%3DFSxTGyuBNcNckyjq'
> Why would you think WAUrlEncoder has nothing to do with url encoding?
> url :=
> 'xmlPath=http://localhost:9090/seaside/tests/facade? 
> 24&_k=QfTdFUeY&_s=FSxTGy
> uBNcNckyjq'.
> String streamContents: [:stream |
> 	url do: [:each | (WAUrlEncoder encode: each on: stream)]]
> It just encodes on character at a time.  Which gives you an  
> identical answer
> up until _k, where I notice that Seaside doesn't encode _'s like your
> examples do, but I believe Seaside is correct here, _'s don't need  
> encoding.
> Ramon Leon

My mistake because I was looking for something to encode the whole  
url, not one character.
After two hours I have found what I was looking for: String>>>  
encodeForHTTP encodes the whole string:

xmlUrl := xmlUrl encodeForHTTP.

But it does not encode all (just like Seaside), it does not encode  
the '_' and the '.' as you can see from this result:


So I will rewrite it to encode those characters as well, like the  
tool at http://www.dommermuth-1.com/protosite/experiments/encode/ 
index.html .
This tool is written in Flash and does encode the '_' and '.'  also.  
I need the conversion Flash uses because it is for passing url's with  
FlashVars to Flash.

The question that remains is why some characters are not encoded and  
others are.

Thank you for the help

More information about the seaside mailing list