Java difference between two URL-encoded strings

What is the difference between two encoded strings?

%D0%9E%D0%BA%D0%B6%D1%8D%D0%B7

and

%26%231055%3B%26%231088%3B%26%231080%3B%26%231074%3B%26%231077%3B%26%231090%3B

I am trying to url Encode the Russian text “Hello” to the second encoded line above (the W3Schools encoder does this correctly), but the URL encoder that I use continues to give me the first encoded line above. I am using URLUTF8Encoder.java from the W3 consortium. I have to use this one as I work on a mobile platform requiring J2ME.

Thank!

+3
source share
2 answers

The URL encoder in w3schools does this completely wrong. %D0%9E%D0%BA%D0%B6%D1%8D%D0%B7works great. This is also what I get when I do

String encoded = URLEncoder.encode("", "UTF-8");

URL- w3schools

String decoded = URLDecoder.decode("%26%231055%3B%26%231088%3B%26%231080%3B%26%231074%3B%26%231077%3B%26%231090%3B", "UTF-8");

Привет, , XML-.

w3schools, , W3. . w3fools.

+6

"" :

%D0%9E    
%D0%BA
%D0%B6
%D1%8D
%D0%B7

, , HTML url:

%26%231055%3B
%26%231088%3B
%26%231080%3B
%26%231074%3B
%26%231077%3B
%26%231090%3B

%26 is &, %23 is #, %3B is ;:

П
р
и
в
е
т
+3

All Articles