users@glassfish.java.net

URLEncoder bug?

From: <glassfish_at_javadesktop.org>
Date: Thu, 10 Jul 2008 09:38:24 PDT

Hello,

I am recently coding some comet application where I need to insert data to response header. The data to be inserted is UTF-8 so it needs to be encoded. I am encoding it with

URLEncoder.encoder(myString)

and from the javascript side, after I get myString from the responseHeader, I make a

decodeURLComponent(myString)

problem is URLEncoder encodes space to +, however for a space decodeURLComponet expects a +.

what am I doing wrong? either one of the encoder or decoder is wrong.

Best.
[Message sent by forum member 'segfault2007' (segfault2007)]

http://forums.java.net/jive/thread.jspa?messageID=285718