Jerome Louvel wrote:
Hi Marc,
This is the intended behavior. For query string, you get auto-decoding using a Form.
For other situations (path variables), you can manually use
Reference.decode(URI) methods.
ah cool, patched my sample with that call and things get decoded
allright now, thx.
To display them correctly in the (text/plain) representation I needed to
add the
result.setCharacterSet(CharacterSet.UTF_8);
Just a follow up question: for reading the request params I found:
- from the query-string
request.getResourceRef().getQueryAsForm(); // optional param charset
- from the http body
request.getEntityAsForm();
(noticing this last one doesn't have an optional charset param I'm
assuming whatever the Content-type header specified will be applied here?)
What I didn't find however is an easy method that returns the
combination of both sets in one call (as POST URI's can hold request
params in both URI and body, and e.g. servlet API
request.getParameters() combines those)
regards,
-marc=
Best regards,
Jerome
-----Message d'origine-----
De : Marc Portier [mailto:[EMAIL PROTECTED] De la part
de Marc Portier
Envoyé : jeudi 26 juillet 2007 15:20
À : [email protected]
Objet : encoding of URI's
Short question,
I was testing the sample for Users and Orders recently
(org.restlet.example.tutorial.Part12)
When I enter as test URL:
http://localhost:8182/users/me/orders/REST-ME-SOME-€
in the browser, it will transform it to the utf-8 +
formencoded version:
http://localhost:8182/users/me/orders/REST-ME-SOME-%E2%82%AC
yielding the server to respond with
Order "REST-ME-SOME-%E2%82%AC" for user "me"
Which shows that the system hasn't been doing any
form-decoding on the
URL yet.
Is this intended like this?
Should I be setting some configuration to get it done, or do
I need to
manually convert things?
regards,
-marc=