-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

All,

I've got a problem with a vendor and I'd like another opinion just to
make sure I'm not crazy. The vendor and I have a difference of opinion
about how a character should be encoded in an HTTP POST request.

The vendor's API officially should accept requests in UTF-8 encoding.
We are using application/x-www-form-urlencoded content type.

I'm trying to send a message with a non-ASCII character -- for
example, a ® (that's (R), the registered trademark symbol).

The Java code being used to package-up this POST looks something like
this:

OutputStream out = httpurlconnection.getOutputStream();
out.print("notetext=");
out.print(URLEncoder.encode("test®", "UTF-8"));
out.close();

So the POST payload ends up being notetext=test%C2%AE or, on the wire,
the bytes are 6e 6f 74 65 74 65 78 74 3d 74 65 73 74 25 43 32 25 41 45.

The final bytes 25 43 32 25 41 45 are the characters % C 2 % A E.

Can someone verify that I'm encoding everything correctly?

The vendor is claiming that ® can be sent "directly" like one might do
using curl:

$ curl -d 'notetext=®' [url]

and the bytes on the wire are 6e 6f 74 65 74 65 78 74 3d c2 ae (note
that c2 and ae are "bare" and not %-encoded).

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYLbzjAAoJEBzwKT+lPKRYaYoP/2oXJV2vhL4bLuZ2SF/0K46E
cQvPE6QbL+6OeC3jfpPKICDd0/0mFmbIxusdKDEcOeKWogVC+lH2by4ghMz4/s/3
dHqi4XYdCymGAikx+khptsna5ITlEgwSVNgCxeZUtMK1MKVpJqa7qOrZkddRi9uZ
RuT54WZ7iVSqOxHvGBf6pJ148Oh0J9gPKMrEdTW48avulvYzKagAH8XgIs8uOM8c
Cvd3yPhRxGLD8tenIrPOiD6G6PYRaSnBY5dOp42vvLXvBPb++bsqNU69RpnxNz1D
W+2BD8P6MDOJQChyBAILBmhhJRLPBQQYZuXtMjAfUCceLYichao515rdpCRX7t7g
Lcyiaz6ht5vOo1iW/r05GviKNl02Fi4BA5gOGaFewlAEwBJIDkPG/NeHXFM8clsy
gRJnmXRtL5IR5hudASMqiRQf0AUG3Ss+gVXXHdsqc+XuE7Q0VawjonCqDLCDwGpG
ZNMIULyWdUosCd5gC47rRN7irsclfOJ8ynI2WREGPlTTml8TKaIhrsaoB4RI4M4r
dUxAgDFOiONwZuXy53peAp6jziUwjqZS2H6BTwSXu+p6+RKvgGL5IuHP3UFfwQbL
JYzakySFoBR6FxN3fiotXKtwAXMtE77k4irzuc/iSxmDmJTdwatRuIQTHbXRoDm0
HcQh/hM/mVNcgRZJ+aqh
=heIv
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to