RoyZeng / odata4j

Automatically exported from code.google.com/p/odata4j
0 stars 0 forks source link

URI Encoded and Decoded Incorrectly #231

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create a $filter like "$filter='this is + simple'
2. Attach a breakpoint in your producer where encoded URIs come in or in 
OData4j where encoded URIs are sent.

What is the expected output? What do you see instead?

You will see that the string is encoded to be something like:
"$filter='this+is+%2B+simple'"

If that string is encoded correctly (using RFC 2396) it should be:
"$filter='this%20is%20%2B%20simple'"

or

"$filter='this%20is%20+%20simple'"

What version of the product are you using? On what operating system?
OData4j 0.6 and 0.7 have the problem, on windows.

Please provide any additional information below.

Proper URI encoding/decoding is done based on RFC 2396.  java.net.URLEncoder 
and java.net.URLDecoder, do not use RFC 2396.  The name unfortunately is 
misleading but they are not intended to be used to encode/decode a URI that you 
use in OData, or would type into your browser address bar.

Instead, use java.net.URI which clearly states in the documentation that it 
uses RFC 2396.

Original issue reported on code.google.com by matthew....@gmail.com on 22 Nov 2012 at 9:16

GoogleCodeExporter commented 9 years ago
Another case where request URLs are not properrly encoded is when the urk 
contains non-ASCII charactes.
For example URL with cyrrilic characters is encoded incorrectly and cannot be 
used from odata4j. WCF Data Services and all modern browsers handle this URL 
correctly

Example URL:
http://vnote:8080/InfoBaseOdata/odata/infobase.odata/Catalogs_Магазин

Original comment by vbkudria...@gmail.com on 3 May 2013 at 2:16

GoogleCodeExporter commented 9 years ago
Hi, first time using OData, need to use OData4j to parse coming uri with 
$filter.
What API do I use to do this? Do you have an example?

Original comment by mehdi.be...@gmail.com on 7 Oct 2013 at 10:52