List of utility methods to do Char to Unicode
void | charToUnicode(char c) char To Unicode System.out.println(Integer.toHexString(("" + c).codePointAt(0)));
|
String | charToUnicodeEscape(char c) Convert a character to its corresponding Unicode escape sequence. return charToUnicodeEscape(c, new StringBuilder()); |
String | charToUnicodeLiteral(int value) char To Unicode Literal String sTemp = Integer.toHexString(value); sTemp = ("0000" + sTemp).substring(sTemp.length()); return "\\u" + sTemp; |
void | charToUnicodeSequence(final StringBuilder buf, final char ch) char To Unicode Sequence buf.append("\\u");
buf.append(toHex((ch >> 12) & MAX_HEX_DIGIT));
buf.append(toHex((ch >> 8) & MAX_HEX_DIGIT));
buf.append(toHex((ch >> 4) & MAX_HEX_DIGIT));
buf.append(toHex(ch & MAX_HEX_DIGIT));
|
byte | charToUtf8(char ch, byte[] bytes, int start) char To Utf int codePoint = (int) ch; if (codePoint <= 0x007F) { bytes[start] = (byte) codePoint; return 1; } else if (codePoint <= 0x07FF) { bytes[start++] = (byte) (3 << 6 | codePoint >>> 6); bytes[start] = (byte) (128 | (byte) (codePoint & 0x3F)); return 2; ... |
String | toGreek(char c) Return the unicode representation of a letter in the greek alphabet, where 'a' correspond to 'alpha', 'b' to 'beta' and so on StringBuilder txt = new StringBuilder(); if (Character.isLetter(c)) txt.appendCodePoint(945 + c - 'a'); else txt.append(c); return txt.toString(); |