public static synchronized void mapMsCodepoint(int msCodepoint, int unicodeCodepoint) { initMsCodepointMap(); msCodepointToUnicode.put(msCodepoint, unicodeCodepoint); }
/** * Some strings may contain encoded characters of the unicode private use area. * Currently the characters of the symbol fonts are mapped to the corresponding * characters in the normal unicode range. * * @param string the original string * @return the string with mapped characters * @see <a href="http://www.alanwood.net/unicode/private_use_area.html#symbol">Private Use Area (symbol)</a> * @see <a href="http://www.alanwood.net/demos/symbol.html">Symbol font - Unicode alternatives for Greek and special characters in HTML</a> */ public static String mapMsCodepointString(String string) { if (string == null || string.isEmpty()) return string; initMsCodepointMap(); StringBuilder sb = new StringBuilder(); final int length = string.length(); for (int offset = 0; offset < length; ) { Integer msCodepoint = string.codePointAt(offset); Integer uniCodepoint = msCodepointToUnicode.get(msCodepoint); sb.appendCodePoint(uniCodepoint == null ? msCodepoint : uniCodepoint); offset += Character.charCount(msCodepoint); } return sb.toString(); }
public static synchronized void mapMsCodepoint(int msCodepoint, int unicodeCodepoint) { initMsCodepointMap(); msCodepointToUnicode.put(msCodepoint, unicodeCodepoint); }
/** * Some strings may contain encoded characters of the unicode private use area. * Currently the characters of the symbol fonts are mapped to the corresponding * characters in the normal unicode range. * * @param string the original string * @return the string with mapped characters * @see <a href="http://www.alanwood.net/unicode/private_use_area.html#symbol">Private Use Area (symbol)</a> * @see <a href="http://www.alanwood.net/demos/symbol.html">Symbol font - Unicode alternatives for Greek and special characters in HTML</a> */ public static String mapMsCodepointString(String string) { if (string == null || string.isEmpty()) return string; initMsCodepointMap(); StringBuilder sb = new StringBuilder(); final int length = string.length(); for (int offset = 0; offset < length; ) { Integer msCodepoint = string.codePointAt(offset); Integer uniCodepoint = msCodepointToUnicode.get(msCodepoint); sb.appendCodePoint(uniCodepoint == null ? msCodepoint : uniCodepoint); offset += Character.charCount(msCodepoint); } return sb.toString(); }