Commit 97d0a889 authored by captainwong's avatar captainwong

fix 2

parent 150d23f2
...@@ -24,11 +24,11 @@ public class SimpleServer { ...@@ -24,11 +24,11 @@ public class SimpleServer {
String HEX_STRING = "0123456789ABCDEF"; String HEX_STRING = "0123456789ABCDEF";
String s = ""; String s = "";
for(int i = 0; i < b.length; i++){ for(int i = 0; i < b.length; i++){
char c = b[i]; int c = b[i] & 0xFF;
if(32 <= c && c <= 127){ if(32 <= c && c <= 127){
s += (char)c; s += (char)c;
}else{ }else{
s += "\\x" + HEX_STRING.charAt((byte)c >>> 4); s += "\\x" + HEX_STRING.charAt(c >>> 4);
s += HEX_STRING.charAt(c & 0x0F); s += HEX_STRING.charAt(c & 0x0F);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment