Four Js Development Tools Forum

Discussions by product => GWS => Topic started by: Jan S. on December 03, 2014, 05:13:17 pm



Title: URL encoding
Post by: Jan S. on December 03, 2014, 05:13:17 pm
Hi,

we implement REST services in the Genero thru the GAS and have a problem with url encoding.
Client can send us some searching criteria in url parameters. Criteria values can contain characters with Czech diacritics.

for example:
/gas/ws/r/pp/v1/prestupky?ulice=Boženy Němcové

client uses UTF-8 to encode url :
/gas/ws/r/pp/v1/prestupky?ulice=Bo%C5%BEeny%20N%C4%9Bmcov%C3%A9

FGLWSDEBUG output is OK:
WS-DEBUG (Receive)
GET /gas/ws/r/pp/v1/prestupky?ulice=Bo%C5%BEeny%20N%C4%9Bmcov%C3%A9 HTTP/1.1
WS-DEBUG END

but url obtained by com.HTTPServiceRequest.getURL() contains wrong characters:
/gas/ws/r/pp/v1/prestupky?ulice=BoĹženy NÄ~[mcovĂŠ

It seems like Genero consider url to be encoded in ISO-8859-2 instead of UTF-8.
We were trying set our environment completely to UTF-8 but with no luck. We are still getting wrong characters.

What factors affect the url decoding? What shoud we change?


Thanks

Jan


Title: Re: URL encoding
Post by: Frank G. on December 03, 2014, 06:02:19 pm
Hi,

  This is a known issue registered as GWS-271 : HTTP client and server API should handle UTF-8 in URL encoding and decoding.

Current implementation considers only ASCII characters during URL encoding and decoding. All characters not in the ASCII table will be escaped with %XX. I'm sorry, but if the client encodes the URL in UTF-8 first, Genero will not be able to URL decode it properly on server side because the %XX characters will simply by converted to locale charset.

This will be fixed for Genero V3 as API will have to be updated to handle potential charset conversion error.

Regards,
Frank