[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [ajug-members]: Java/Flash URL Encoding



Title: RE: [ajug-members]: Java/Flash URL Encoding

In Flash I just did: unescape("Hello+World") and it came back correctly as "Hello World".

Here's what I found in the specifications:

The Flash documentation says simply: "all nonalphanumeric characters are escaped with % hexadecimal sequences." But the ECMAScript docs(which Actionscript is based on) states that each char is converted to a 16-bit unsigned integer before encoding. Everything except: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./" is encoded. If the hexadecimal value of the char is less than 256 then it is encoded as %xy, if larger then it's encoded as %uwxyz where wxyz are hex digits. This is based on RFC1738.

I don't see any Charset in Java based on the same RFC.

Also note that the above is from the ECMAScript specification and not Actionscript, so Flash may differ depending on how closely it conforms to the standard it is supposed to follow.

- Byron Saltysiak



-----Original Message-----
From: Dan Glauser [mailto:dan@roundboxmedia.com]
Sent: Friday, May 28, 2004 12:09 PM
To: ajug-members@ajug.org
Subject: [ajug-members]: Java/Flash URL Encoding


Hello All,

As a temporary solution I'm encoding an xml string and placing it in a
JSP page that has a Flash component.  The problem is the encoding is
different, Flash's encoding expect a space to be represented as:

%20

Whereas java.net.URLEncoder.encode(String, "UTF-8") represents a space
as:

+

This isn't the only difference but just one example.  Does anyone have
any experience getting these two encoders to place nicely together?  I'm
not locked into UTF-8 on the Java side, I don't care what it is.  I'm
just trying to match it up to the Flash encoder.  Unfortunately the
documentation on the Flash side is rather sparse.

Any ideas are appreciated.

Thanks!

--
Dan Glauser
J2EE Architect
Roundbox Media
dan@roundboxmedia.com
W: 404.877.0107