01: package snow.html;
02:
03: public final class HTMLUtils {
04: private HTMLUtils() {
05: }
06:
07: /** replaces the line return with <br> and some subtelties, like "<" and ">"
08: */
09: public static String convertCharsToHTML(String str) {
10: // keep that order !!
11: str = str.replace("<", "<");
12: str = str.replace(">", ">");
13: str = str.replace("\r\n", "<br>");
14: str = str.replace("\n", "<br>");
15: return str;
16: }
17:
18: /*public static String createHTMLFromText(String str)
19: {
20: return "<html><body>"+convertCharsToHTML(str);
21: }*/
22:
23: public static String createCODEHTMLFromText(String str) {
24: // keep that order !!
25: return "<html><body><pre>" + convertCharsToHTML(str) + "</pre>";
26: }
27:
28: public static String[][] someHTMLCodes = new String[][] {
29: { "ä", "ä" }, { "ö", "ö" }, { "ü", "ü" },
30: { "Ä", "Ä" }, { "Ö", "Ö" }, { "Ü", "Ü" },
31: { "ß", "ß" }, { "é", "é" },
32: { "è", "è" }, { "ê", "ê" },
33: { "à", "á" }, { "ç", "ç" },
34: { "ø", "ø" }, { "œ", "œ" },
35: { "æ", "æ" }, { "ñ", "ñ" }, { "<", "<" },
36: { ">", ">" }, { "»", """ }, { "&", "&" },
37: { "+", "€" }, { "£", "£" }, { "¥", "¥" },
38: { "¡", "¡" }, { "¿", "¿" }, { "©", "©" },
39: { "®", "®" }, { "§", "§" }, { "«", "«" },
40: { "»", "»" } };
41:
42: }
|