Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] UTF-8 Bug or Improper Usage?

Hi Eric,

sorry, I've been confused because I've not taken care of what you try to encode there. %e7 is not valid utf8 bytes and that's why it doesn't work. In utf8 the c with a cedilla is represented by two bytes c3 and a7. The proper uri would look like:

URL: /?i=e%c3%a7

And that can be successfully decoded by jetty to utf8. Here's a nice tool to encode/decode chars: http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=%E7&mode=char

Cheers,
Thomas



On 10/9/11 10:27 PM, Eric Y. Theriault wrote:
Hi--



Yes, you are correct that the jar that generated that error is *NOT* the latest (that was 7.5.1-2011-0908), however, the latest still contains the an error -- here's the updated stack trace.

URL: /?i=e%e7

java.lang.IllegalArgumentException: Tried to read incomplete UTF8 decoded String
    at org.eclipse.jetty.util.Utf8StringBuilder.checkState(Utf8StringBuilder.java:75)
    at org.eclipse.jetty.util.Utf8StringBuilder.toString(Utf8StringBuilder.java:68)
    at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To(UrlEncoded.java:319)
    at org.eclipse.jetty.http.HttpURI.decodeQueryTo(HttpURI.java:638)
    at org.eclipse.jetty.server.Request.extractParameters(Request.java:211)
    at org.eclipse.jetty.server.Request.getParameter(Request.java:671)
    ... my code that first calls this line ....

Apologies for the mistake, but I do not believe that it is new with the latest version.  Please let me know if you need further information or if you think it may be user-error.  Thanks.



eyt*

On 10/9/2011 1:08 PM, Thomas Becker wrote:
Hi again,

are you 100% sure that you upgraded to Jetty 7.5.2.v20111006? Because the stacktrace you pasted is belonging to the old Utf8Appendable implementation and the jetty version you named definetly contains the new Utf8Appendable.java version. Could you please send me the jetty-util-7.5.2.v20111006.jar you have in the distribution where the error occurs? If you're still using an old version for some reason then I wonder why the error only appeared after you've upgraded jetty.

Cheers,
Thomas

On 10/8/11 6:46 AM, Eric Y. Theriault wrote:
Hi--



I've been using jetty for a while now and have recently upgraded to the Jetty 7 (specifically Jetty 7.5.2.v20111006).  Since doing so, I periodically notice an exception like this:

 org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: !UTF-8
	at org.eclipse.jetty.util.Utf8Appendable.appendByte(Utf8Appendable.java:73)
	at org.eclipse.jetty.util.Utf8Appendable.append(Utf8Appendable.java:23)
	at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To(UrlEncoded.java:312)
	at org.eclipse.jetty.http.HttpURI.decodeQueryTo(HttpURI.java:638)
	at org.eclipse.jetty.server.Request.extractParameters(Request.java:209)
	at org.eclipse.jetty.server.Request.getParameter(Request.java:662)
	// my code that does the first request.getParameter...

I've been trying to find a URL that causes this particular issue and I've recently found one with %E7 (C with the Cedilla), which I believe is OK to the standard.  That said, certain URL's with this character code raise the above exception, such as this one: http://localhost/?i=e%e7 .

Can someone confirm whether or not the above URL is correct, whether or not there is some configuration that is required to make it work, or if there's a bug there.  Thanks!



eyt*


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users

-- 
thomas becker
tbecker@xxxxxxxxxxx

http://webtide.com / http://intalio.com
(the folks behind jetty and cometd)


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users

-- 
thomas becker
tbecker@xxxxxxxxxxx

http://webtide.com / http://intalio.com
(the folks behind jetty and cometd)

Back to the top