android - encoding different in Coldfusion and Java -
when encode string charset utf-8
gives different results in java , coldfusion
string encode:
1 two`< newline >`three 4
result in android (java):
one+two%0athree+four
result in coldfusion:
one%20two%0d%0athree%20four
i thought utf-8
defines standard , every technology follows while encoding/decoding using utf-8
. doesn't seem case. charset should rely on?
coldfusion code encode string:
<cfset encodedstring = urlencodedformat(str,"utf-8")>
java code encode string:
urlencoder.encode(str,"utf-8");
your problem not related utf-8. because there plain ascii characters here!
what doing url encoding, , there indeed multiple versions of this.
in http query string, space encoded +
.
the percent %
encoding of space %20
.
sometimes can utilize either encoding, can't... usually, using +
spaces, android class did, more compatible in experience. because there lot of broken code out there doesn't decode.
https://en.wikipedia.org/wiki/query_string#url_encoding
https://en.wikipedia.org/wiki/percent-encoding
java android coldfusion coldfusion-10
No comments:
Post a Comment