del: obsolete entity table and test method

This commit is contained in:
Tobi Schäfer 2020-03-27 21:13:11 +01:00
parent 75f609d095
commit ae50bc562e

View file

@ -23,147 +23,6 @@ import java.util.*;
* for HTML output.
*/
public final class HtmlEncoder {
// transformation table for characters 128 to 255. These actually fall into two
// groups, put together for efficiency: "Windows" chacacters 128-159 such as
// "smart quotes", which are encoded to valid Unicode entities, and
// valid ISO-8859 caracters 160-255, which are encoded to the symbolic HTML
// entity. Everything >= 256 is encoded to a numeric entity.
//
// for mor on HTML entities see http://www.pemberley.com/janeinfo/latin1.html and
// ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT
//
static final String[] transform = {
"€", // 128
"", // empty string means character is undefined in unicode
"‚",
"ƒ",
"„",
"…",
"†",
"‡",
"ˆ",
"‰",
"Š",
"‹",
"Œ",
"",
"Ž",
"",
"",
"‘",
"’",
"“",
"”",
"•",
"–",
"—",
"˜",
"™",
"š",
"›",
"œ",
"",
"ž",
"Ÿ", // 159
" ", // 160
"¡",
"¢",
"£",
"¤",
"¥",
"¦",
"§",
"¨",
"©",
"ª",
"«",
"¬",
"­",
"®",
"¯",
"°",
"±",
"²",
"³",
"´",
"µ",
"¶",
"·",
"¸",
"¹",
"º",
"»",
"¼",
"½",
"¾",
"¿",
"À",
"Á",
"Â",
"Ã",
"Ä",
"Å",
"Æ",
"Ç",
"È",
"É",
"Ê",
"Ë",
"Ì",
"Í",
"Î",
"Ï",
"Ð",
"Ñ",
"Ò",
"Ó",
"Ô",
"Õ",
"Ö",
"×",
"Ø",
"Ù",
"Ú",
"Û",
"Ü",
"Ý",
"Þ",
"ß",
"à",
"á",
"â",
"ã",
"ä",
"å",
"æ",
"ç",
"è",
"é",
"ê",
"ë",
"ì",
"í",
"î",
"ï",
"ð",
"ñ",
"ò",
"ó",
"ô",
"õ",
"ö",
"÷",
"ø",
"ù",
"ú",
"û",
"ü",
"ý",
"þ",
"ÿ" // 255
};
// HTML block tags need to suppress automatic newline to <br>
// conversion around them to look good. However, they differ
// in how many newlines around them should ignored. These sets
@ -887,32 +746,6 @@ public final class HtmlEncoder {
}
}
// test method
public static String printCharRange(int from, int to) {
StringBuffer response = new StringBuffer();
for (int i = from; i < to; i++) {
response.append(i);
response.append(" ");
response.append((char) i);
response.append(" ");
if (i < 128) {
response.append((char) i);
} else if ((i >= 128) && (i < 256)) {
response.append(transform[i - 128]);
} else {
response.append("&#");
response.append(i);
response.append(";");
}
response.append("\r\n");
}
return response.toString();
}
// for testing...
public static void main(String[] args) {
for (int i = 0; i < args.length; i++)