%2D%2D%3e%20%d0%9d%d0%b0%d0%96%d0%bc%d0%98%20%5b%2b%5d%20%3c%2D%2D
private String urlName(String url) {
if (url == null) return null;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < url.length(); i++) {
char ch = url.charAt(i);
switch (ch) {
default:
if (ch < '200') {
sb.append(ch);
break;
}
if (ch > '177' && ch < 'u0800') {
sb.append('%');
sb.append(Integer.toHexString((ch >> 6 | 0xc0) + 256).substring(1));
sb.append('%');
sb.append(Integer.toHexString((ch & 0x3f | 0x80) + 256).substring(1));
break;
}
if (ch > 'u07FF' && ch < ' ') {
sb.append('%');
sb.append(Integer.toHexString((ch >> 12 | 0xe0) + 256).substring(1));
sb.append('%');
sb.append(Integer.toHexString((ch >> 6 & 0x3f | 0x80) + 256).substring(1));
sb.append('%');
sb.append(Integer.toHexString((ch & 0x3f | 0x80) + 256).substring(1));
}
break;
case 0: //' '
case 32: sb.append("%20"); break;// ' '
case 61: sb.append("%3d"); break;// '='
case 43: sb.append("%2b"); break;// '+'
case 39: sb.append("%27"); break;// '''
case 46: sb.append("%2E"); break;// '.'
case 60: sb.append("%3c"); break;// '<'
case 62: sb.append("%3e"); break;// '>'
case 35: sb.append("%23"); break;// '#'
case 37: sb.append("%25"); break;// '%'
case 38: sb.append("%26"); break;// '&'
case 123:sb.append("%7b"); break;// '{'
case 125:sb.append("%7d"); break;// '}'
case 92: sb.append("%5c"); break;// '\'
case 94: sb.append("%5e"); break;// '^'
case 126:sb.append("%73"); break;// '~'
case 91: sb.append("%5b"); break;// '['
case 93: sb.append("%5d"); break;// ']'
case 58: sb.append("%3A"); break;// ':'
case 47: sb.append("%2F"); break;// '/'
case 63: sb.append("%3F"); break;// '?'
case 45: sb.append("%2D"); break;// '-'
case 33: sb.append("%21"); break;// '!'
case 59: sb.append("%3B"); break;// ';'
}
}
return sb.toString();
}