package iiuf.util; /** Unicode to HTML translator. (c) 1999, 2000, 2001, IIUF, DIUF<p> @author $Author: ohitz $ @version $Revision: 1.1 $ */ public class UTHTML extends UnicodeTranslator implements Unicode { final static String[] UNICODE2HTML = { nbsp , " ", // non breaking space iexcl , "¡", // inverted exclamation mark cent , "¢", // cent sign pound , "£", // pund sign curren , "¤", // currency sign yen , "¥", // yen sign brvbar , "¦", // broken bar sect , "§", // section sign Dot , "¨", // diaeresis copy , "©", // copyright sign ordf , "ª", // feminine ordinal indicator Lt , "≪", // left pointing double angle quotation mark () not , "¬", // not sign shy , "­", // soft hyphen reg , "®", // registered sign macr , "¯", // macron deg , "°", // degree sogn plusmn , "&plusm;", // plus minus sign sup2 , "²", // superscript two sup3 , "³", // superscript three acute , "´", // acute accent mcro , "&mcro;", // micro sign para , "¶", // pilcrow sign middot , "·", // middle dot cedil , "¸", // cedilla sup1 , "¹", // superscrip one ordm , "º", // masculine ordinal indicator Gt , "≫", // right pointing double angle quotation mark frac14 , "¼", // vulgar fraction one quarter frac12 , "½", // vulgar fraction one half frac34 , "¾", // vulagar fraction three quarter iquest , "¿", // inverted question mark Agrave , "À", Aacute , "Á", Acirc , "Â", Atilde , "Ã", Auml , "Ä", Aring , "Å", AElig , "Æ", Ccedil , "Ç", Egrave , "È", Eacute , "É", Ecirc , "Ê", Euml , "Ë", Igrave , "Ì", Iacute , "Í", Icirci , "Îi;", Iuml , "Ï", ETH , "Ð", // latin capital letter ETH Ntilde , "Ñ", Ograve , "Ò", Oacute , "Ó", Ocirc , "Ô", Otilde , "Õ", Ouml , "Ö", times , "×", // multiplication sign Ostrok , "&Ostrok;", Ugrave , "Ù", Uacute , "Ú", Ucircr , "Ûr;", Uuml , "Ü", Yacute , "Ý", THORN , "Þ", // latin capital letter thorn szlig , "ß", agrave , "à", aacute , "á", acirc , "â", atilde , "ã", auml , "ä", aring , "å", aelig , "æ", ccedil , "ç", egrave , "è", eacute , "é", ecirc , "ê", euml , "ë", igrave , "ì", iacute , "í", icirc , "î", iuml , "ï", eth , "ð", // latin small letter eth ntilde , "ñ", ograve , "ò", oacute , "ó", ocirc , "ô", otilde , "õ", ouml , "ö", divide , "÷", // division sign ostrok , "&ostrok;", ugrave , "ù", ucute , "&ucute;", ucircr , "ûr;", uuml , "ü", yacute , "ý", thorn , "þ", // latin small letter thorn yuml , "ÿ", inodot , "ı", // LATIN SMALL LETTER DOTLESS I OElig , "Œ", // LATIN CAPITAL LIGATURE OE oelig , "œ", // LATIN SMALL LIGATURE OE Yuml , "Ÿ", // LATIN CAPITAL LETTER Y WITH DIAERESIS fnof , "ƒ", // LATIN SMALL LETTER F WITH HOOK circ , "ˆ", // MODIFIER LETTER CIRCUMFLEX ACCENT caron , "ˇ", // CARON breve , "˘", // BREVE dot , "˙", // DOT ABOVE ring , "˚", // RING ABOVE ogon , "˛", // OGONEK tilde , "˜", // SMALL TILDE dblac , "˝", // DOUBLE ACUTE ACCENT OHgr , "&OHgr;", // GREEK CAPITAL LETTER OMEGA b_pi , "&b_pi;", // GREEK SMALL LETTER PI ndash , "–", // EN DASH mdash , "—", // EM DASH rsquor , "’", // LEFT SINGLE QUOTATION MARK rsquo , "’", // RIGHT SINGLE QUOTATION MARK lsquor , "‚", // SINGLE LOW-9 QUOTATION MARK ldquo , "“", // LEFT DOUBLE QUOTATION MARK rdquo , "”", // RIGHT DOUBLE QUOTATION MARK bdquo , "„", // DOUBLE LOW-9 QUOTATION MARK dagger , "†", // DAGGER Dagger , "‡", // DOUBLE DAGGER bull , "•", // BULLET hellip , "…", // HORIZONTAL ELLIPSIS permil , "‰", // PER MILLE SIGN lsaquo , "‹", // SINGLE LEFT-POINTING ANGLE QUOTATION MARK rsaquo , "›", // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK frasl , "⁄", // FRACTION SLASH euro , "€", // EURO SIGN trade , "™", // TRADE MARK SIGN part , "∂", // PARTIAL DIFFERENTIAL Delta , "Δ", // INCREMENT prod , "∏", // N-ARY PRODUCT sum , "∑", // N-ARY SUMMATION radic , "√", // SQUARE ROOT infin , "∞", // INFINITY int_ , "∫", // INTEGRAL thkap , "≈", // ALMOST EQUAL TO ne , "&nr;", // NOT EQUAL TO le , "≤", // LESS-THAN OR EQUAL TO ge , "≥", // GREATER-THAN OR EQUAL TO loz , "◊", // LOZENGE _APPLE_LOGO , "_APPLE_LOGO", // Apple logo filig , "fi", // LATIN SMALL LIGATURE FI fllig , "fl", // LATIN SMALL LIGATURE FL }; static String[] HTML2UNICODE = invTable(UNICODE2HTML); /** The default translator instance. */ public static UnicodeTranslator trans = new UTHTML(); private UTHTML() { super(UNICODE2HTML); } public String getUnicode(String nstr) { return UnicodeTrans.trans(nstr, HTML2UNICODE); } public String getNative(String unicode) { return UnicodeTrans.trans(unicode, UNICODE2HTML); } public static void main(String[] argv) { System.out.println("getNative(" + argv[0] + ") = " + UTHTML.trans.getNative (argv[0])); System.out.println("getUnicode(" + argv[0] + ") = " + UTHTML.trans.getUnicode(argv[0])); } } /* $Log: UTHTML.java,v $ Revision 1.1 2002/07/11 12:00:11 ohitz Initial checkin Revision 1.3 2001/01/04 16:28:42 schubige Header update for 2001 and DIUF Revision 1.2 2000/05/01 12:41:42 schubige intermediate checkin after UT update Revision 1.1 2000/04/25 12:11:15 schubige pre bibtex restart commit */