Here's the "The Encyclo Eagle" where you can find a lot of knowledge about everything on earth. besides: news, science, geography, sports &

seen from Russia
seen from China

seen from United States
seen from India
seen from Türkiye
seen from United States
seen from United States
seen from Canada
seen from China
seen from United States
seen from United States
seen from United States
seen from United States

seen from Germany

seen from Mexico

seen from United States
seen from China

seen from China

seen from Switzerland

seen from Switzerland
Here's the "The Encyclo Eagle" where you can find a lot of knowledge about everything on earth. besides: news, science, geography, sports &
适合于J2ME的GB2312 URLencoder(也适合于UTF8)
使用:
URLencoder.encode(str, "GB2312");//GB2312编码
URLencoder.encode(str, "UTF-8");//UTF-8编码
源代码:
import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; /** * Adapted from J2SE java.net.URLEncoder. */ public class URLGB2312encoder { public static String encode(String s, String enc) throws UnsupportedEncodingException { boolean needToChange = false; boolean wroteUnencodedChar = false; int maxBytesPerChar = 10; // rather arbitrary limit, but safe for now StringBuffer out = new StringBuffer(s.length()); ByteArrayOutputStream buf = new ByteArrayOutputStream(maxBytesPerChar); OutputStreamWriter writer = new OutputStreamWriter(buf, enc); for (int i = 0; i < s.length(); i++) { int c = (int) s.charAt(i); if (dontNeedEncoding(c)) { if (c == ' ') { c = '+'; needToChange = true; } out.append((char)c); wroteUnencodedChar = true; } else { // convert to external encoding before hex conversion try { if (wroteUnencodedChar) { // Fix for 4407610 writer = new OutputStreamWriter(buf, enc); wroteUnencodedChar = false; } writer.write(c); /* * If this character represents the start of a Unicode * surrogate pair, then pass in two characters. It's not * clear what should be done if a bytes reserved in the * surrogate pairs range occurs outside of a legal * surrogate pair. For now, just treat it as if it were * any other character. */ if (c >= 0xD800 && c <= 0xDBFF) { /* System.out.println(Integer.toHexString(c) + " is high surrogate"); */ if ( (i+1) < s.length()) { int d = (int) s.charAt(i+1); /* System.out.println("\tExamining " + Integer.toHexString(d)); */ if (d >= 0xDC00 && d <= 0xDFFF) { /* System.out.println("\t" + Integer.toHexString(d) + " is low surrogate"); */ writer.write(d); i++; } } } writer.flush(); } catch(IOException e) { buf.reset(); continue; } byte[] ba = buf.toByteArray(); for (int j = 0; j < ba.length; j++) { out.append('%'); char ch = CCharacter.forDigit((ba[j] >> 4) & 0xF, 16); out.append(ch); ch = CCharacter.forDigit(ba[j] & 0xF, 16); out.append(ch); } buf.reset(); needToChange = true; } } return (needToChange? out.toString() : s); } static class CCharacter { public static char forDigit(int digit, int radix) { if ((digit >= radix) || (digit < 0)) { return '\0'; } if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX)) { return '\0'; } if (digit < 10) { return (char)('0' + digit); } return (char)('A' - 10 + digit); } } public static boolean dontNeedEncoding(int ch){ int len = _dontNeedEncoding.length(); boolean en = false; for(int i =0;i< len;i++){ if(_dontNeedEncoding.charAt(i) == ch) { en = true; break; } } return en; } //private static final int caseDiff = ('a' - 'A'); private static String _dontNeedEncoding = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -_.*"; }
ll