d138361a23f1f02fa520c6057d2ec5ed31ffacc3
[debian/jabref.git] / src / java / net / sf / jabref / Globals.java
1 /* (C) 2003 Nizar N. Batada, Morten O. Alver
2
3  All programs in this directory and
4  subdirectories are published under the GNU General Public License as
5  described below.
6
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or (at
10  your option) any later version.
11
12  This program is distributed in the hope that it will be useful, but
13  WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  General Public License for more details.
16
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  USA
21
22  Further information about the GNU GPL is available at:
23  http://www.gnu.org/copyleft/gpl.ja.html
24
25  */
26 package net.sf.jabref;
27
28 import java.io.*;
29 import java.nio.charset.Charset;
30 import java.util.*;
31 import java.util.List;
32 import java.util.logging.*;
33 import java.util.logging.Filter;
34
35 import java.awt.*;
36 import javax.swing.*;
37
38 import net.sf.jabref.collab.*;
39 import net.sf.jabref.imports.*;
40 import net.sf.jabref.util.*;
41 import net.sf.jabref.journals.JournalAbbreviations;
42
43 public class Globals {
44
45         public static int SHORTCUT_MASK,// =
46                 // Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
47                 FUTURE_YEAR = 2050, // Needs to give a year definitely in the future.
48                 // Used for guessing the
49                 // year field when parsing textual data. :-)
50
51                 STANDARD_EXPORT_COUNT = 5, // The number of standard export formats.
52                 METADATA_LINE_LENGTH = 70; // The line length used to wrap metadata.
53
54         private static String resourcePrefix = "resource/JabRef", menuResourcePrefix = "resource/Menu",
55                 integrityResourcePrefix = "resource/IntegrityMessage";
56
57         private static final String buildInfos = "/resource/build.properties";
58
59         /*
60          * some extra field definitions
61          */
62         public static final String additionalFields = "/resource/fields/fields.xml";
63
64         public static ResourceBundle messages, menuTitles, intMessages;
65
66         public static FileUpdateMonitor fileUpdateMonitor = new FileUpdateMonitor();
67
68         public static ImportFormatReader importFormatReader = new ImportFormatReader();
69
70         public static ErrorConsole errorConsole;
71
72         public static String VERSION, BUILD, BUILD_DATE;
73
74         static {
75                 TBuildInfo bi = new TBuildInfo(buildInfos);
76                 VERSION = bi.getBUILD_VERSION();
77                 BUILD = bi.getBUILD_NUMBER();
78                 BUILD_DATE = bi.getBUILD_DATE();
79
80                 // TODO: Error console initialization here. When should it be used?
81                 errorConsole = ErrorConsole.getInstance();
82         }
83
84         // public static ResourceBundle preferences =
85         // ResourceBundle.getBundle("resource/defaultPrefs");
86         public static Locale locale;
87
88         public static final String FILETYPE_PREFS_EXT = "_dir", SELECTOR_META_PREFIX = "selector_",
89                 LAYOUT_PREFIX = "/resource/layout/", MAC = "Mac OS X",
90                 DOI_LOOKUP_PREFIX = "http://dx.doi.org/", NONE = "_non__",
91                 FORMATTER_PACKAGE = "net.sf.jabref.export.layout.format.";
92
93         public static float duplicateThreshold = 0.75f;
94
95         private static Handler consoleHandler = new java.util.logging.ConsoleHandler();
96
97         public static String[] ENCODINGS, ALL_ENCODINGS = // (String[])
98                 // Charset.availableCharsets().keySet().toArray(new
99                 // String[]{});
100                 new String[] { "ISO8859_1", "UTF8", "UTF-16", "ASCII", "Cp1250", "Cp1251", "Cp1252",
101                         "Cp1253", "Cp1254", "Cp1257", "JIS", "SJIS",
102                         "EUC_JP", // Added Japanese encodings.
103                         "Big5", "Big5_HKSCS", "GBK", "ISO8859_2", "ISO8859_3", "ISO8859_4", "ISO8859_5",
104                         "ISO8859_6", "ISO8859_7", "ISO8859_8", "ISO8859_9", "ISO8859_13", "ISO8859_15" };
105
106         // String array that maps from month number to month string label:
107         public static String[] MONTHS = new String[] { "jan", "feb", "mar", "apr", "may", "jun", "jul",
108                 "aug", "sep", "oct", "nov", "dec" };
109
110         // Map that maps from month string labels to
111         public static Map MONTH_STRINGS = new HashMap();
112         static {
113                 MONTH_STRINGS.put("jan", "January");
114                 MONTH_STRINGS.put("feb", "February");
115                 MONTH_STRINGS.put("mar", "March");
116                 MONTH_STRINGS.put("apr", "April");
117                 MONTH_STRINGS.put("may", "May");
118                 MONTH_STRINGS.put("jun", "June");
119                 MONTH_STRINGS.put("jul", "July");
120                 MONTH_STRINGS.put("aug", "August");
121                 MONTH_STRINGS.put("sep", "September");
122                 MONTH_STRINGS.put("oct", "October");
123                 MONTH_STRINGS.put("nov", "November");
124                 MONTH_STRINGS.put("dec", "December");
125
126                 // Build list of encodings, by filtering out all that are not supported
127                 // on this system:
128                 List encodings = new ArrayList();
129                 for (int i = 0; i < ALL_ENCODINGS.length; i++) {
130                         if (Charset.isSupported(ALL_ENCODINGS[i])) {
131                                 encodings.add(ALL_ENCODINGS[i]);
132                         }
133                 }
134                 ENCODINGS = (String[]) encodings.toArray(new String[0]);
135
136         }
137
138         public static GlobalFocusListener focusListener = new GlobalFocusListener();
139
140         public static JabRefPreferences prefs = null;
141
142         public static HelpDialog helpDiag = null;
143
144         public static String osName = System.getProperty("os.name", "def");
145
146         public static boolean ON_MAC = (osName.equals(MAC)), ON_WIN = osName.startsWith("Windows");
147
148         public static String[] SKIP_WORDS = { "a", "an", "the", "for", "on" };
149
150         public static SidePaneManager sidePaneManager;
151
152         public static final String NEWLINE = System.getProperty("line.separator");
153
154         /**
155          * true if we have unix newlines
156          */
157         public static final boolean UNIX_NEWLINE = NEWLINE.equals("\n");
158
159         public static final String BIBTEX_STRING = "__string";
160
161         // "Fieldname" to indicate that a field should be treated as a bibtex
162         // string. Used when writing database to file.
163
164         public static void logger(String s) {
165                 Logger.global.info(s);
166         }
167
168         public static void turnOffLogging() { // only log exceptions
169                 Logger.global.setLevel(java.util.logging.Level.SEVERE);
170         }
171
172         // should be only called once
173         public static void turnOnConsoleLogging() {
174                 Logger.global.addHandler(consoleHandler);
175
176         }
177
178         public static void turnOnFileLogging() {
179                 Logger.global.setLevel(java.util.logging.Level.ALL);
180                 java.util.logging.Handler handler;
181                 handler = new ConsoleHandler();
182                 /*
183                  * try { handler = new FileHandler(logfile); // this will overwrite }
184                  * catch (IOException e) { //can't open log file so use console
185                  * e.printStackTrace(); }
186                  */
187                 Logger.global.addHandler(handler);
188
189                 handler.setFilter(new Filter() { // select what gets logged
190                                 public boolean isLoggable(LogRecord record) {
191                                         return true;
192                                 }
193                         });
194         }
195
196         public static void setLanguage(String language, String country) {
197                 locale = new Locale(language, country);
198                 messages = ResourceBundle.getBundle(resourcePrefix, locale);
199                 menuTitles = ResourceBundle.getBundle(menuResourcePrefix, locale);
200                 intMessages = ResourceBundle.getBundle(integrityResourcePrefix, locale);
201                 Locale.setDefault(locale);
202                 javax.swing.JComponent.setDefaultLocale(locale);
203         }
204
205         public static JournalAbbreviations journalAbbrev;
206
207         public static String lang(String key, String[] params) {
208                 String translation = null;
209                 try {
210                         if (Globals.messages != null) {
211                                 translation = Globals.messages.getString(key.replaceAll(" ", "_"));
212                         }
213                 } catch (MissingResourceException ex) {
214                         translation = key;
215
216                         // Thread.dumpStack(); // For debugging
217                         logger("Warning: could not get translation for \"" + key + "\"");
218                 }
219                 if ((translation != null) && (translation.length() != 0)) {
220                         translation = translation.replaceAll("_", " ");
221                         StringBuffer sb = new StringBuffer();
222                         boolean b = false;
223                         char c;
224                         for (int i = 0; i < translation.length(); ++i) {
225                                 c = translation.charAt(i);
226                                 if (c == '%') {
227                                         b = true;
228                                 } else {
229                                         if (!b) {
230                                                 sb.append(c);
231                                         } else {
232                                                 b = false;
233                                                 try {
234                                                         int index = Integer.parseInt(String.valueOf(c));
235                                                         if (params != null && index >= 0 && index <= params.length)
236                                                                 sb.append(params[index]);
237                                                 } catch (NumberFormatException e) {
238                                                         // append literally (for quoting) or insert special
239                                                         // symbol
240                                                         switch (c) {
241                                                         case 'c': // colon
242                                                                 sb.append(':');
243                                                                 break;
244                                                         case 'e': // equal
245                                                                 sb.append('=');
246                                                                 break;
247                                                         default: // anything else, e.g. %
248                                                                 sb.append(c);
249                                                         }
250                                                 }
251                                         }
252                                 }
253                         }
254                         return sb.toString();
255                 }
256                 return key;
257         }
258
259         public static String lang(String key) {
260                 return lang(key, (String[]) null);
261         }
262
263         public static String lang(String key, String s1) {
264                 return lang(key, new String[] { s1 });
265         }
266
267         public static String lang(String key, String s1, String s2) {
268                 return lang(key, new String[] { s1, s2 });
269         }
270
271         public static String lang(String key, String s1, String s2, String s3) {
272                 return lang(key, new String[] { s1, s2, s3 });
273         }
274
275         public static String menuTitle(String key) {
276                 String translation = null;
277                 try {
278                         if (Globals.messages != null) {
279                                 translation = Globals.menuTitles.getString(key.replaceAll(" ", "_"));
280                         }
281                 } catch (MissingResourceException ex) {
282                         translation = key;
283
284                         // System.err.println("Warning: could not get menu item translation
285                         // for \""
286                         // + key + "\"");
287
288                 }
289                 if ((translation != null) && (translation.length() != 0)) {
290                         return translation.replaceAll("_", " ");
291                 } else {
292                         return key;
293                 }
294         }
295
296         public static String getIntegrityMessage(String key) {
297                 String translation = null;
298                 try {
299                         if (Globals.intMessages != null) {
300                                 translation = Globals.intMessages.getString(key);
301                         }
302                 } catch (MissingResourceException ex) {
303                         translation = key;
304
305                         // System.err.println("Warning: could not get menu item translation
306                         // for \""
307                         // + key + "\"");
308                 }
309                 if ((translation != null) && (translation.length() != 0)) {
310                         return translation;
311                 } else {
312                         return key;
313                 }
314         }
315
316         // ============================================================
317         // Using the hashmap of entry types found in BibtexEntryType
318         // ============================================================
319         public static BibtexEntryType getEntryType(String type) {
320                 // decide which entryType object to return
321                 Object o = BibtexEntryType.ALL_TYPES.get(type);
322                 if (o != null) {
323                         return (BibtexEntryType) o;
324                 } else {
325                         return BibtexEntryType.OTHER;
326                 }
327                 /*
328                  * if(type.equals("article")) return BibtexEntryType.ARTICLE; else
329                  * if(type.equals("book")) return BibtexEntryType.BOOK; else
330                  * if(type.equals("inproceedings")) return
331                  * BibtexEntryType.INPROCEEDINGS;
332                  */
333         }
334
335         /**
336          * This method provides the correct opening brace to use when writing a
337          * field to BibTeX format.
338          * 
339          * @return A String containing the braces to use.
340          */
341         public static String getOpeningBrace() {
342                 return "{";
343                 /*
344                  * As of version 2.0, storing all fields with double braces is no longer
345                  * supported, because it causes problems with e.g. the author field.
346                  * 
347                  * if (prefs.getBoolean("autoDoubleBraces")) return "{{"; else return
348                  * "{";
349                  */
350         }
351
352         /**
353          * This method provides the correct closing brace to use when writing a
354          * field to BibTeX format.
355          * 
356          * @return A String containing the braces to use.
357          */
358         public static String getClosingBrace() {
359                 return "}";
360                 /*
361                  * As of version 2.0, storing all fields with double braces is no longer
362                  * supported, because it causes problems with e.g. the author field.
363                  * 
364                  * if (prefs.getBoolean("autoDoubleBraces")) return "}}"; else
365                  */
366
367         }
368
369         /**
370          * Will return the names of multiple files selected in the given directory
371          * and the given extensions.
372          * 
373          * Will return an empty String array if no entry is found.
374          * 
375          * @param owner
376          * @param directory
377          * @param extension
378          * @param updateWorkingdirectory
379          * @return
380          */
381         public static String[] getMultipleFiles(JFrame owner, File directory, String extension,
382                 boolean updateWorkingdirectory) {
383
384                 OpenFileFilter off = null;
385                 if (extension == null)
386                         off = new OpenFileFilter();
387                 else if (!extension.equals(NONE))
388                         off = new OpenFileFilter(extension);
389
390                 Object files = getNewFileImpl(owner, directory, extension, null, off,
391                         JFileChooser.OPEN_DIALOG, updateWorkingdirectory, false, true);
392
393                 if (files instanceof String[]) {
394                         return (String[]) files;
395                 }
396                 // Fix for:
397                 // http://sourceforge.net/tracker/index.php?func=detail&aid=1538769&group_id=92314&atid=600306
398                 if (files != null) {
399                         return new String[] { (String) files };
400                 }
401                 return new String[0];
402         }
403
404         public static String getNewFile(JFrame owner, File directory, String extension, int dialogType,
405                 boolean updateWorkingDirectory) {
406                 return getNewFile(owner, directory, extension, null, dialogType, updateWorkingDirectory,
407                         false);
408         }
409
410         public static String getNewFile(JFrame owner, File directory, String extension,
411                 String description, int dialogType, boolean updateWorkingDirectory) {
412                 return getNewFile(owner, directory, extension, description, dialogType,
413                         updateWorkingDirectory, false);
414         }
415
416         public static String getNewDir(JFrame owner, File directory, String extension, int dialogType,
417                 boolean updateWorkingDirectory) {
418                 return getNewFile(owner, directory, extension, null, dialogType, updateWorkingDirectory,
419                         true);
420         }
421
422         public static String getNewDir(JFrame owner, File directory, String extension,
423                 String description, int dialogType, boolean updateWorkingDirectory) {
424                 return getNewFile(owner, directory, extension, description, dialogType,
425                         updateWorkingDirectory, true);
426         }
427
428         private static String getNewFile(JFrame owner, File directory, String extension,
429                 String description, int dialogType, boolean updateWorkingDirectory, boolean dirOnly) {
430
431                 OpenFileFilter off = null;
432
433                 if (extension == null)
434                         off = new OpenFileFilter();
435                 else if (!extension.equals(NONE))
436                         off = new OpenFileFilter(extension);
437
438                 return (String) getNewFileImpl(owner, directory, extension, description, off, dialogType,
439                         updateWorkingDirectory, dirOnly, false);
440         }
441
442         private static Object getNewFileImpl(JFrame owner, File directory, String extension,
443                 String description, OpenFileFilter off, int dialogType, boolean updateWorkingDirectory,
444                 boolean dirOnly, boolean multipleSelection) {
445
446                 if (ON_MAC && prefs.getBoolean("useNativeFileDialogOnMac")) {
447
448                         return getNewFileForMac(owner, directory, extension, dialogType,
449                                 updateWorkingDirectory, dirOnly, off);
450                 }
451
452                 JFileChooser fc = null;
453                 try {
454                         fc = new JabRefFileChooser(directory);
455                 } catch (InternalError errl) {
456                         // This try/catch clause was added because a user reported an
457                         // InternalError getting thrown on WinNT, presumably because of a
458                         // bug in JGoodies Windows PLAF. This clause can be removed if the
459                         // bug is fixed, but for now we just resort to the native file
460                         // dialog, using the same method as is always used on Mac:
461                         return getNewFileForMac(owner, directory, extension, dialogType,
462                                 updateWorkingDirectory, dirOnly, off);
463                 }
464
465                 if (dirOnly) {
466                         fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
467
468                 }
469
470                 fc.setMultiSelectionEnabled(multipleSelection);
471
472                 fc.addChoosableFileFilter(off);
473                 fc.setDialogType(dialogType);
474                 int dialogResult;
475                 if (dialogType == JFileChooser.OPEN_DIALOG) {
476                         dialogResult = fc.showOpenDialog(owner);
477                 } else if (dialogType == JFileChooser.SAVE_DIALOG) {
478                         dialogResult = fc.showSaveDialog(owner);
479                 } else {
480                         dialogResult = fc.showDialog(owner, description);
481                 }
482
483                 // the getSelectedFile method returns a valid fileselection
484                 // (if something is selected) indepentently from dialog return status
485                 if (dialogResult != JFileChooser.APPROVE_OPTION)
486                         return null;
487
488                 // okay button
489                 File selectedFile = fc.getSelectedFile();
490                 if (selectedFile == null) { // cancel
491                         return null;
492                 }
493
494                 // If this is a save dialog, and the user has not chosen "All files" as
495                 // filter
496                 // we enforce the given extension. But only if extension is not null.
497                 if ((extension != null) && (dialogType == JFileChooser.SAVE_DIALOG)
498                         && (fc.getFileFilter() == off) && !off.accept(selectedFile)) {
499
500                         // add the first extension if there are multiple extensions
501                         selectedFile = new File(selectedFile.getPath() + extension.split("[, ]+", 0)[0]);
502                 }
503
504                 if (updateWorkingDirectory) {
505                         prefs.put("workingDirectory", selectedFile.getPath());
506                 }
507
508                 if (!multipleSelection)
509                         return selectedFile.getAbsolutePath();
510                 else {
511                         File[] files = fc.getSelectedFiles();
512                         String[] filenames = new String[files.length];
513                         for (int i = 0; i < files.length; i++)
514                                 filenames[i] = files[i].getAbsolutePath();
515                         return filenames;
516                 }
517         }
518
519         private static String getNewFileForMac(JFrame owner, File directory, String extensions,
520                 int dialogType, boolean updateWorkingDirectory, boolean dirOnly, FilenameFilter filter) {
521
522                 FileDialog fc = new FileDialog(owner);
523
524                 // fc.setFilenameFilter(filter);
525                 if (directory != null) {
526                         fc.setDirectory(directory.getParent());
527                 }
528                 if (dialogType == JFileChooser.OPEN_DIALOG) {
529                         fc.setMode(FileDialog.LOAD);
530                 } else {
531                         fc.setMode(FileDialog.SAVE);
532                 }
533
534                 fc.setVisible(true); // fc.show(); -> deprecated since 1.5
535
536                 if (fc.getFile() != null) {
537                         Globals.prefs.put("workingDirectory", fc.getDirectory() + fc.getFile());
538                         return fc.getDirectory() + fc.getFile();
539                 } else {
540                         return null;
541                 }
542         }
543
544         public static String SPECIAL_COMMAND_CHARS = "\"`^~'c";
545
546         public static HashMap HTML_CHARS = new HashMap(), HTMLCHARS = new HashMap(),
547                 XML_CHARS = new HashMap(), ASCII2XML_CHARS = new HashMap(), UNICODE_CHARS = new HashMap(),
548                 RTFCHARS = new HashMap(), URL_CHARS = new HashMap();
549         static {
550
551                 // System.out.println(journalAbbrev.getAbbreviatedName("Journal of Fish
552                 // Biology", true));
553                 // System.out.println(journalAbbrev.getAbbreviatedName("Journal of Fish
554                 // Biology", false));
555                 // System.out.println(journalAbbrev.getFullName("Aquaculture Eng."));
556                 /*
557                  * for (Iterator i=journalAbbrev.fullNameIterator(); i.hasNext();) {
558                  * String s = (String)i.next();
559                  * System.out.println(journalAbbrev.getFullName(s)+" :
560                  * "+journalAbbrev.getAbbreviatedName(s, true)); }
561                  */
562
563                 // Start the thread that monitors file time stamps.
564                 // Util.pr("Starting FileUpdateMonitor thread. Globals line 293.");
565                 fileUpdateMonitor.start();
566
567                 try {
568                         SHORTCUT_MASK = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
569                 } catch (Throwable t) {
570
571                 }
572
573                 // Special characters in URLs need to be replaced to ensure that the URL
574                 // opens properly on all platforms:
575                 URL_CHARS.put("<", "%3c");
576                 URL_CHARS.put(">", "%3e");
577                 URL_CHARS.put("(", "%28");
578                 URL_CHARS.put(")", "%29");
579                 URL_CHARS.put(" ", "%20");
580                 URL_CHARS.put("&", "%26");
581                 URL_CHARS.put("$", "%24");
582
583                 // HTMLCHARS.put("\"a", "&auml;");
584                 // HTMLCHARS.put("\"A", "&Auml;");
585                 // HTMLCHARS.put("\"e", "&euml;");
586                 // HTMLCHARS.put("\"E", "&Euml;");
587                 // HTMLCHARS.put("\"i", "&iuml;");
588                 // HTMLCHARS.put("\"I", "&Iuml;");
589                 // HTMLCHARS.put("\"o", "&ouml;");
590                 // HTMLCHARS.put("\"O", "&Ouml;");
591                 // HTMLCHARS.put("\"u", "&uuml;");
592                 // HTMLCHARS.put("\"U", "&Uuml;");
593                 // HTMLCHARS.put("`a", "&agrave;");
594                 // HTMLCHARS.put("`A", "&Agrave;");
595                 // HTMLCHARS.put("`e", "&egrave;");
596                 // HTMLCHARS.put("`E", "&Egrave;");
597                 // HTMLCHARS.put("`i", "&igrave;");
598                 // HTMLCHARS.put("`I", "&Igrave;");
599                 // HTMLCHARS.put("`o", "&ograve;");
600                 // HTMLCHARS.put("`O", "&Ograve;");
601                 // HTMLCHARS.put("`u", "&ugrave;");
602                 // HTMLCHARS.put("`U", "&Ugrave;");
603                 // HTMLCHARS.put("'e", "&eacute;");
604                 // HTMLCHARS.put("'E", "&Eacute;");
605                 // HTMLCHARS.put("'i", "&iacute;");
606                 // HTMLCHARS.put("'I", "&Iacute;");
607                 // HTMLCHARS.put("'o", "&oacute;");
608                 // HTMLCHARS.put("'O", "&Oacute;");
609                 // HTMLCHARS.put("'u", "&uacute;");
610                 // HTMLCHARS.put("'U", "&Uacute;");
611                 // HTMLCHARS.put("'a", "&aacute;");
612                 // HTMLCHARS.put("'A", "&Aacute;");
613                 // HTMLCHARS.put("^a", "&ocirc;");
614                 // HTMLCHARS.put("^A", "&Ocirc;");
615                 // HTMLCHARS.put("^o", "&ocirc;");
616                 // HTMLCHARS.put("^O", "&Ocirc;");
617                 // HTMLCHARS.put("^u", "&ucirc;");
618                 // HTMLCHARS.put("^U", "&Ucirc;");
619                 // HTMLCHARS.put("^e", "&ecirc;");
620                 // HTMLCHARS.put("^E", "&Ecirc;");
621                 // HTMLCHARS.put("^i", "&icirc;");
622                 // HTMLCHARS.put("^I", "&Icirc;");
623                 // HTMLCHARS.put("~o", "&otilde;");
624                 // HTMLCHARS.put("~O", "&Otilde;");
625                 // HTMLCHARS.put("~n", "&ntilde;");
626                 // HTMLCHARS.put("~N", "&Ntilde;");
627                 // HTMLCHARS.put("~a", "&atilde;");
628                 // HTMLCHARS.put("~A", "&Atilde;");
629                 // HTMLCHARS.put("cc", "&ccedil;");
630                 // HTMLCHARS.put("cC", "&Ccedil;");
631
632                 // Following character definitions contributed by Ervin Kolenovic:
633                 // HTML named entities from #192 - #255 (UNICODE Latin-1)
634                 HTMLCHARS.put("`A", "&Agrave;"); // #192
635                 HTMLCHARS.put("'A", "&Aacute;"); // #193
636                 HTMLCHARS.put("^A", "&Acirc;"); // #194
637                 HTMLCHARS.put("~A", "&Atilde;"); // #195
638                 HTMLCHARS.put("\"A", "&Auml;"); // #196
639                 HTMLCHARS.put("AA", "&Aring;"); // #197
640                 HTMLCHARS.put("AE", "&AElig;"); // #198
641                 HTMLCHARS.put("cC", "&Ccedil;"); // #199
642                 HTMLCHARS.put("`E", "&Egrave;"); // #200
643                 HTMLCHARS.put("'E", "&Eacute;"); // #201
644                 HTMLCHARS.put("^E", "&Ecirc;"); // #202
645                 HTMLCHARS.put("\"E", "&Euml;"); // #203
646                 HTMLCHARS.put("`I", "&Igrave;"); // #204
647                 HTMLCHARS.put("'I", "&Iacute;"); // #205
648                 HTMLCHARS.put("^I", "&Icirc;"); // #206
649                 HTMLCHARS.put("\"I", "&Iuml;"); // #207
650                 HTMLCHARS.put("DH", "&ETH;"); // #208
651                 HTMLCHARS.put("~N", "&Ntilde;"); // #209
652                 HTMLCHARS.put("`O", "&Ograve;"); // #210
653                 HTMLCHARS.put("'O", "&Oacute;"); // #211
654                 HTMLCHARS.put("^O", "&Ocirc;"); // #212
655                 HTMLCHARS.put("~O", "&Otilde;"); // #213
656                 HTMLCHARS.put("\"O", "&Ouml;"); // #214
657                 // According to ISO 8859-1 the "\times" symbol should be placed here
658                 // (#215).
659                 // Omitting this, because it is a mathematical symbol.
660                 HTMLCHARS.put("O", "&OSlash;"); // #216
661                 HTMLCHARS.put("`U", "&Ugrave;"); // #217
662                 HTMLCHARS.put("'U", "&Uacute;"); // #218
663                 HTMLCHARS.put("^U", "&Ucirc;"); // #219
664                 HTMLCHARS.put("\"U", "&Uuml;"); // #220
665                 HTMLCHARS.put("'Y", "&Yacute;"); // #221
666                 HTMLCHARS.put("TH", "&THORN;"); // #222
667                 HTMLCHARS.put("ss", "&szlig;"); // #223
668                 HTMLCHARS.put("`a", "&agrave;"); // #224
669                 HTMLCHARS.put("'a", "&aacute;"); // #225
670                 HTMLCHARS.put("^a", "&acirc;"); // #226
671                 HTMLCHARS.put("~a", "&atilde;"); // #227
672                 HTMLCHARS.put("\"a", "&auml;"); // #228
673                 HTMLCHARS.put("aa", "&aring;"); // #229
674                 HTMLCHARS.put("ae", "&aelig;"); // #230
675                 HTMLCHARS.put("cc", "&ccedil;"); // #231
676                 HTMLCHARS.put("`e", "&egrave;"); // #232
677                 HTMLCHARS.put("'e", "&eacute;"); // #233
678                 HTMLCHARS.put("^e", "&ecirc;"); // #234
679                 HTMLCHARS.put("\"e", "&euml;"); // #235
680                 HTMLCHARS.put("`i", "&igrave;"); // #236
681                 HTMLCHARS.put("'i", "&iacute;"); // #237
682                 HTMLCHARS.put("^i", "&icirc;"); // #238
683                 HTMLCHARS.put("\"i", "&iuml;"); // #239
684                 HTMLCHARS.put("dh", "&eth;"); // #240
685                 HTMLCHARS.put("~n", "&ntilde;"); // #241
686                 HTMLCHARS.put("`o", "&ograve;"); // #242
687                 HTMLCHARS.put("'o", "&oacute;"); // #243
688                 HTMLCHARS.put("^o", "&ocirc;"); // #244
689                 HTMLCHARS.put("~o", "&otilde;"); // #245
690                 HTMLCHARS.put("\"o", "&ouml;"); // #246
691                 // According to ISO 8859-1 the "\div" symbol should be placed here
692                 // (#247).
693                 // Omitting this, because it is a mathematical symbol.
694                 HTMLCHARS.put("o", "&oslash;"); // #248
695                 HTMLCHARS.put("`u", "&ugrave;"); // #249
696                 HTMLCHARS.put("'u", "&uacute;"); // #250
697                 HTMLCHARS.put("^u", "&ucirc;"); // #251
698                 HTMLCHARS.put("\"u", "&uuml;"); // #252
699                 HTMLCHARS.put("'y", "&yacute;"); // #253
700                 HTMLCHARS.put("th", "&thorn;"); // #254
701                 HTMLCHARS.put("\"y", "&yuml;"); // #255
702
703                 // HTML special characters without names (UNICODE Latin Extended-A),
704                 // indicated by UNICODE number
705                 HTMLCHARS.put("=A", "&#256;"); // "Amacr"
706                 HTMLCHARS.put("=a", "&#257;"); // "amacr"
707                 HTMLCHARS.put("uA", "&#258;"); // "Abreve"
708                 HTMLCHARS.put("ua", "&#259;"); // "abreve"
709                 HTMLCHARS.put("kA", "&#260;"); // "Aogon"
710                 HTMLCHARS.put("ka", "&#261;"); // "aogon"
711                 HTMLCHARS.put("'C", "&#262;"); // "Cacute"
712                 HTMLCHARS.put("'c", "&#263;"); // "cacute"
713                 HTMLCHARS.put("^C", "&#264;"); // "Ccirc"
714                 HTMLCHARS.put("^c", "&#265;"); // "ccirc"
715                 HTMLCHARS.put(".C", "&#266;"); // "Cdot"
716                 HTMLCHARS.put(".c", "&#267;"); // "cdot"
717                 HTMLCHARS.put("vC", "&#268;"); // "Ccaron"
718                 HTMLCHARS.put("vc", "&#269;"); // "ccaron"
719                 HTMLCHARS.put("vD", "&#270;"); // "Dcaron"
720                 // Symbol #271 (d´) has no special Latex command
721                 HTMLCHARS.put("DJ", "&#272;"); // "Dstrok"
722                 HTMLCHARS.put("dj", "&#273;"); // "dstrok"
723                 HTMLCHARS.put("=E", "&#274;"); // "Emacr"
724                 HTMLCHARS.put("=e", "&#275;"); // "emacr"
725                 HTMLCHARS.put("uE", "&#276;"); // "Ebreve"
726                 HTMLCHARS.put("ue", "&#277;"); // "ebreve"
727                 HTMLCHARS.put(".E", "&#278;"); // "Edot"
728                 HTMLCHARS.put(".e", "&#279;"); // "edot"
729                 HTMLCHARS.put("kE", "&#280;"); // "Eogon"
730                 HTMLCHARS.put("ke", "&#281;"); // "eogon"
731                 HTMLCHARS.put("vE", "&#282;"); // "Ecaron"
732                 HTMLCHARS.put("ve", "&#283;"); // "ecaron"
733                 HTMLCHARS.put("^G", "&#284;"); // "Gcirc"
734                 HTMLCHARS.put("^g", "&#285;"); // "gcirc"
735                 HTMLCHARS.put("uG", "&#286;"); // "Gbreve"
736                 HTMLCHARS.put("ug", "&#287;"); // "gbreve"
737                 HTMLCHARS.put(".G", "&#288;"); // "Gdot"
738                 HTMLCHARS.put(".g", "&#289;"); // "gdot"
739                 HTMLCHARS.put("cG", "&#290;"); // "Gcedil"
740                 HTMLCHARS.put("'g", "&#291;"); // "gacute"
741                 HTMLCHARS.put("^H", "&#292;"); // "Hcirc"
742                 HTMLCHARS.put("^h", "&#293;"); // "hcirc"
743                 HTMLCHARS.put("Hstrok", "&#294;"); // "Hstrok"
744                 HTMLCHARS.put("hstrok", "&#295;"); // "hstrok"
745                 HTMLCHARS.put("~I", "&#296;"); // "Itilde"
746                 HTMLCHARS.put("~i", "&#297;"); // "itilde"
747                 HTMLCHARS.put("=I", "&#298;"); // "Imacr"
748                 HTMLCHARS.put("=i", "&#299;"); // "imacr"
749                 HTMLCHARS.put("uI", "&#300;"); // "Ibreve"
750                 HTMLCHARS.put("ui", "&#301;"); // "ibreve"
751                 HTMLCHARS.put("kI", "&#302;"); // "Iogon"
752                 HTMLCHARS.put("ki", "&#303;"); // "iogon"
753                 HTMLCHARS.put(".I", "&#304;"); // "Idot"
754                 HTMLCHARS.put("i", "&#305;"); // "inodot"
755                 // Symbol #306 (IJ) has no special Latex command
756                 // Symbol #307 (ij) has no special Latex command
757                 HTMLCHARS.put("^J", "&#308;"); // "Jcirc"
758                 HTMLCHARS.put("^j", "&#309;"); // "jcirc"
759                 HTMLCHARS.put("cK", "&#310;"); // "Kcedil"
760                 HTMLCHARS.put("ck", "&#311;"); // "kcedil"
761                 // Symbol #312 (k) has no special Latex command
762                 HTMLCHARS.put("'L", "&#313;"); // "Lacute"
763                 HTMLCHARS.put("'l", "&#314;"); // "lacute"
764                 HTMLCHARS.put("cL", "&#315;"); // "Lcedil"
765                 HTMLCHARS.put("cl", "&#316;"); // "lcedil"
766                 // Symbol #317 (L´) has no special Latex command
767                 // Symbol #318 (l´) has no special Latex command
768                 HTMLCHARS.put("Lmidot", "&#319;"); // "Lmidot"
769                 HTMLCHARS.put("lmidot", "&#320;"); // "lmidot"
770                 HTMLCHARS.put("L", "&#321;"); // "Lstrok"
771                 HTMLCHARS.put("l", "&#322;"); // "lstrok"
772                 HTMLCHARS.put("'N", "&#323;"); // "Nacute"
773                 HTMLCHARS.put("'n", "&#324;"); // "nacute"
774                 HTMLCHARS.put("cN", "&#325;"); // "Ncedil"
775                 HTMLCHARS.put("cn", "&#326;"); // "ncedil"
776                 HTMLCHARS.put("vN", "&#327;"); // "Ncaron"
777                 HTMLCHARS.put("vn", "&#328;"); // "ncaron"
778                 // Symbol #329 (´n) has no special Latex command
779                 HTMLCHARS.put("NG", "&#330;"); // "ENG"
780                 HTMLCHARS.put("ng", "&#331;"); // "eng"
781                 HTMLCHARS.put("=O", "&#332;"); // "Omacr"
782                 HTMLCHARS.put("=o", "&#333;"); // "omacr"
783                 HTMLCHARS.put("uO", "&#334;"); // "Obreve"
784                 HTMLCHARS.put("uo", "&#335;"); // "obreve"
785                 HTMLCHARS.put("HO", "&#336;"); // "Odblac"
786                 HTMLCHARS.put("Ho", "&#337;"); // "odblac"
787                 HTMLCHARS.put("OE", "&#338;"); // "OElig"
788                 HTMLCHARS.put("oe", "&#339;"); // "oelig"
789                 HTMLCHARS.put("'R", "&#340;"); // "Racute"
790                 HTMLCHARS.put("'r", "&#341;"); // "racute"
791                 HTMLCHARS.put("cR", "&#342;"); // "Rcedil"
792                 HTMLCHARS.put("cr", "&#343;"); // "rcedil"
793                 HTMLCHARS.put("vR", "&#344;"); // "Rcaron"
794                 HTMLCHARS.put("vr", "&#345;"); // "rcaron"
795                 HTMLCHARS.put("'S", "&#346;"); // "Sacute"
796                 HTMLCHARS.put("'s", "&#347;"); // "sacute"
797                 HTMLCHARS.put("^S", "&#348;"); // "Scirc"
798                 HTMLCHARS.put("^s", "&#349;"); // "scirc"
799                 HTMLCHARS.put("cS", "&#350;"); // "Scedil"
800                 HTMLCHARS.put("cs", "&#351;"); // "scedil"
801                 HTMLCHARS.put("vS", "&#352;"); // "Scaron"
802                 HTMLCHARS.put("vs", "&#353;"); // "scaron"
803                 HTMLCHARS.put("cT", "&#354;"); // "Tcedil"
804                 HTMLCHARS.put("ct", "&#355;"); // "tcedil"
805                 HTMLCHARS.put("vT", "&#356;"); // "Tcaron"
806                 // Symbol #357 (t´) has no special Latex command
807                 HTMLCHARS.put("Tstrok", "&#358;"); // "Tstrok"
808                 HTMLCHARS.put("tstrok", "&#359;"); // "tstrok"
809                 HTMLCHARS.put("~U", "&#360;"); // "Utilde"
810                 HTMLCHARS.put("~u", "&#361;"); // "utilde"
811                 HTMLCHARS.put("=U", "&#362;"); // "Umacr"
812                 HTMLCHARS.put("=u", "&#363;"); // "umacr"
813                 HTMLCHARS.put("uU", "&#364;"); // "Ubreve"
814                 HTMLCHARS.put("uu", "&#365;"); // "ubreve"
815                 HTMLCHARS.put("rU", "&#366;"); // "Uring"
816                 HTMLCHARS.put("ru", "&#367;"); // "uring"
817                 HTMLCHARS.put("HU", "&#368;"); // "Odblac"
818                 HTMLCHARS.put("Hu", "&#369;"); // "odblac"
819                 HTMLCHARS.put("kU", "&#370;"); // "Uogon"
820                 HTMLCHARS.put("ku", "&#371;"); // "uogon"
821                 HTMLCHARS.put("^W", "&#372;"); // "Wcirc"
822                 HTMLCHARS.put("^w", "&#373;"); // "wcirc"
823                 HTMLCHARS.put("^Y", "&#374;"); // "Ycirc"
824                 HTMLCHARS.put("^y", "&#375;"); // "ycirc"
825                 HTMLCHARS.put("\"Y", "&#376;"); // "Yuml"
826                 HTMLCHARS.put("'Z", "&#377;"); // "Zacute"
827                 HTMLCHARS.put("'z", "&#378;"); // "zacute"
828                 HTMLCHARS.put(".Z", "&#379;"); // "Zdot"
829                 HTMLCHARS.put(".z", "&#380;"); // "zdot"
830                 HTMLCHARS.put("vZ", "&#381;"); // "Zcaron"
831                 HTMLCHARS.put("vz", "&#382;"); // "zcaron"
832                 // Symbol #383 (f) has no special Latex command
833
834                 XML_CHARS.put("\\{\\\\\\\"\\{a\\}\\}", "&#x00E4;");
835                 XML_CHARS.put("\\{\\\\\\\"\\{A\\}\\}", "&#x00C4;");
836                 XML_CHARS.put("\\{\\\\\\\"\\{e\\}\\}", "&#x00EB;");
837                 XML_CHARS.put("\\{\\\\\\\"\\{E\\}\\}", "&#x00CB;");
838                 XML_CHARS.put("\\{\\\\\\\"\\{i\\}\\}", "&#x00EF;");
839                 XML_CHARS.put("\\{\\\\\\\"\\{I\\}\\}", "&#x00CF;");
840                 XML_CHARS.put("\\{\\\\\\\"\\{o\\}\\}", "&#x00F6;");
841                 XML_CHARS.put("\\{\\\\\\\"\\{O\\}\\}", "&#x00D6;");
842                 XML_CHARS.put("\\{\\\\\\\"\\{u\\}\\}", "&#x00FC;");
843                 XML_CHARS.put("\\{\\\\\\\"\\{U\\}\\}", "&#x00DC;");
844
845                 XML_CHARS.put("\\{\\\\\\`\\{e\\}\\}", "&#x00E8;");
846                 XML_CHARS.put("\\{\\\\\\`\\{E\\}\\}", "&#x00C8;");
847                 XML_CHARS.put("\\{\\\\\\`\\{i\\}\\}", "&#x00EC;");
848                 XML_CHARS.put("\\{\\\\\\`\\{I\\}\\}", "&#x00CC;");
849                 XML_CHARS.put("\\{\\\\\\`\\{o\\}\\}", "&#x00F2;");
850                 XML_CHARS.put("\\{\\\\\\`\\{O\\}\\}", "&#x00D2;");
851                 XML_CHARS.put("\\{\\\\\\`\\{u\\}\\}", "&#x00F9;");
852                 XML_CHARS.put("\\{\\\\\\`\\{U\\}\\}", "&#x00D9;");
853                 XML_CHARS.put("\\{\\\\\\'\\{e\\}\\}", "&#x00E9;");
854                 XML_CHARS.put("\\{\\\\\\\uFFFD\\{E\\}\\}", "&#x00C9;");
855                 XML_CHARS.put("\\{\\\\\\\uFFFD\\{i\\}\\}", "&#x00ED;");
856                 XML_CHARS.put("\\{\\\\\\\uFFFD\\{I\\}\\}", "&#x00CD;");
857                 XML_CHARS.put("\\{\\\\\\\uFFFD\\{o\\}\\}", "&#x00F3;");
858                 XML_CHARS.put("\\{\\\\\\\uFFFD\\{O\\}\\}", "&#x00D3;");
859                 XML_CHARS.put("\\{\\\\\\\uFFFD\\{u\\}\\}", "&#x00FA;");
860                 XML_CHARS.put("\\{\\\\\\\uFFFD\\{U\\}\\}", "&#x00DA;");
861                 XML_CHARS.put("\\{\\\\\\\uFFFD\\{a\\}\\}", "&#x00E1;");
862                 XML_CHARS.put("\\{\\\\\\\uFFFD\\{A\\}\\}", "&#x00C1;");
863
864                 XML_CHARS.put("\\{\\\\\\^\\{o\\}\\}", "&#x00F4;");
865                 XML_CHARS.put("\\{\\\\\\^\\{O\\}\\}", "&#x00D4;");
866                 XML_CHARS.put("\\{\\\\\\^\\{u\\}\\}", "&#x00F9;");
867                 XML_CHARS.put("\\{\\\\\\^\\{U\\}\\}", "&#x00D9;");
868                 XML_CHARS.put("\\{\\\\\\^\\{e\\}\\}", "&#x00EA;");
869                 XML_CHARS.put("\\{\\\\\\^\\{E\\}\\}", "&#x00CA;");
870                 XML_CHARS.put("\\{\\\\\\^\\{i\\}\\}", "&#x00EE;");
871                 XML_CHARS.put("\\{\\\\\\^\\{I\\}\\}", "&#x00CE;");
872                 XML_CHARS.put("\\{\\\\\\~\\{o\\}\\}", "&#x00F5;");
873                 XML_CHARS.put("\\{\\\\\\~\\{O\\}\\}", "&#x00D5;");
874                 XML_CHARS.put("\\{\\\\\\~\\{n\\}\\}", "&#x00F1;");
875                 XML_CHARS.put("\\{\\\\\\~\\{N\\}\\}", "&#x00D1;");
876                 XML_CHARS.put("\\{\\\\\\~\\{a\\}\\}", "&#x00E3;");
877                 XML_CHARS.put("\\{\\\\\\~\\{A\\}\\}", "&#x00C3;");
878
879                 XML_CHARS.put("\\{\\\\\\\"a\\}", "&#x00E4;");
880                 XML_CHARS.put("\\{\\\\\\\"A\\}", "&#x00C4;");
881                 XML_CHARS.put("\\{\\\\\\\"e\\}", "&#x00EB;");
882                 XML_CHARS.put("\\{\\\\\\\"E\\}", "&#x00CB;");
883                 XML_CHARS.put("\\{\\\\\\\"i\\}", "&#x00EF;");
884                 XML_CHARS.put("\\{\\\\\\\"I\\}", "&#x00CF;");
885                 XML_CHARS.put("\\{\\\\\\\"o\\}", "&#x00F6;");
886                 XML_CHARS.put("\\{\\\\\\\"O\\}", "&#x00D6;");
887                 XML_CHARS.put("\\{\\\\\\\"u\\}", "&#x00FC;");
888                 XML_CHARS.put("\\{\\\\\\\"U\\}", "&#x00DC;");
889
890                 XML_CHARS.put("\\{\\\\\\`e\\}", "&#x00E8;");
891                 XML_CHARS.put("\\{\\\\\\`E\\}", "&#x00C8;");
892                 XML_CHARS.put("\\{\\\\\\`i\\}", "&#x00EC;");
893                 XML_CHARS.put("\\{\\\\\\`I\\}", "&#x00CC;");
894                 XML_CHARS.put("\\{\\\\\\`o\\}", "&#x00F2;");
895                 XML_CHARS.put("\\{\\\\\\`O\\}", "&#x00D2;");
896                 XML_CHARS.put("\\{\\\\\\`u\\}", "&#x00F9;");
897                 XML_CHARS.put("\\{\\\\\\`U\\}", "&#x00D9;");
898                 XML_CHARS.put("\\{\\\\\\'e\\}", "&#x00E9;");
899                 XML_CHARS.put("\\{\\\\\\'E\\}", "&#x00C9;");
900                 XML_CHARS.put("\\{\\\\\\'i\\}", "&#x00ED;");
901                 XML_CHARS.put("\\{\\\\\\'I\\}", "&#x00CD;");
902                 XML_CHARS.put("\\{\\\\\\'o\\}", "&#x00F3;");
903                 XML_CHARS.put("\\{\\\\\\'O\\}", "&#x00D3;");
904                 XML_CHARS.put("\\{\\\\\\'u\\}", "&#x00FA;");
905                 XML_CHARS.put("\\{\\\\\\'U\\}", "&#x00DA;");
906                 XML_CHARS.put("\\{\\\\\\'a\\}", "&#x00E1;");
907                 XML_CHARS.put("\\{\\\\\\'A\\}", "&#x00C1;");
908
909                 XML_CHARS.put("\\{\\\\\\^a\\}", "&#x00F4;");
910                 XML_CHARS.put("\\{\\\\\\^A\\}", "&#x00D4;");
911                 XML_CHARS.put("\\{\\\\\\^o\\}", "&#x00F4;");
912                 XML_CHARS.put("\\{\\\\\\^O\\}", "&#x00D4;");
913                 XML_CHARS.put("\\{\\\\\\^u\\}", "&#x00F9;");
914                 XML_CHARS.put("\\{\\\\\\^U\\}", "&#x00D9;");
915                 XML_CHARS.put("\\{\\\\\\^e\\}", "&#x00EA;");
916                 XML_CHARS.put("\\{\\\\\\^E\\}", "&#x00CA;");
917                 XML_CHARS.put("\\{\\\\\\^i\\}", "&#x00EE;");
918                 XML_CHARS.put("\\{\\\\\\^I\\}", "&#x00CE;");
919                 XML_CHARS.put("\\{\\\\\\~o\\}", "&#x00F5;");
920                 XML_CHARS.put("\\{\\\\\\~O\\}", "&#x00D5;");
921                 XML_CHARS.put("\\{\\\\\\~n\\}", "&#x00F1;");
922                 XML_CHARS.put("\\{\\\\\\~N\\}", "&#x00D1;");
923                 XML_CHARS.put("\\{\\\\\\~a\\}", "&#x00E3;");
924                 XML_CHARS.put("\\{\\\\\\~A\\}", "&#x00C3;");
925
926                 ASCII2XML_CHARS.put("<", "&lt;");
927                 ASCII2XML_CHARS.put("\"", "&quot;");
928                 ASCII2XML_CHARS.put(">", "&gt;");
929
930                 UNICODE_CHARS.put("\u00C0", "A");
931                 UNICODE_CHARS.put("\u00C1", "A");
932                 UNICODE_CHARS.put("\u00C2", "A");
933                 UNICODE_CHARS.put("\u00C3", "A");
934                 UNICODE_CHARS.put("\u00C4", "Ae");
935                 UNICODE_CHARS.put("\u00C5", "Aa");
936                 UNICODE_CHARS.put("\u00C6", "Ae");
937                 UNICODE_CHARS.put("\u00C7", "C");
938                 UNICODE_CHARS.put("\u00C8", "E");
939                 UNICODE_CHARS.put("\u00C9", "E");
940                 UNICODE_CHARS.put("\u00CA", "E");
941                 UNICODE_CHARS.put("\u00CB", "E");
942                 UNICODE_CHARS.put("\u00CC", "I");
943                 UNICODE_CHARS.put("\u00CD", "I");
944                 UNICODE_CHARS.put("\u00CE", "I");
945                 UNICODE_CHARS.put("\u00CF", "I");
946                 UNICODE_CHARS.put("\u00D0", "D");
947                 UNICODE_CHARS.put("\u00D1", "N");
948                 UNICODE_CHARS.put("\u00D2", "O");
949                 UNICODE_CHARS.put("\u00D3", "O");
950                 UNICODE_CHARS.put("\u00D4", "O");
951                 UNICODE_CHARS.put("\u00D5", "O");
952                 UNICODE_CHARS.put("\u00D6", "Oe");
953                 UNICODE_CHARS.put("\u00D8", "Oe");
954                 UNICODE_CHARS.put("\u00D9", "U");
955                 UNICODE_CHARS.put("\u00DA", "U");
956                 UNICODE_CHARS.put("\u00DB", "U");
957                 UNICODE_CHARS.put("\u00DC", "Ue"); // U umlaut ..
958                 UNICODE_CHARS.put("\u00DD", "Y");
959                 UNICODE_CHARS.put("\u00DF", "ss");
960                 UNICODE_CHARS.put("\u00E0", "a");
961                 UNICODE_CHARS.put("\u00E1", "a");
962                 UNICODE_CHARS.put("\u00E2", "a");
963                 UNICODE_CHARS.put("\u00E3", "a");
964                 UNICODE_CHARS.put("\u00E4", "ae");
965                 UNICODE_CHARS.put("\u00E5", "aa");
966                 UNICODE_CHARS.put("\u00E6", "ae");
967                 UNICODE_CHARS.put("\u00E7", "c");
968                 UNICODE_CHARS.put("\u00E8", "e");
969                 UNICODE_CHARS.put("\u00E9", "e");
970                 UNICODE_CHARS.put("\u00EA", "e");
971                 UNICODE_CHARS.put("\u00EB", "e");
972                 UNICODE_CHARS.put("\u00EC", "i");
973                 UNICODE_CHARS.put("\u00ED", "i");
974                 UNICODE_CHARS.put("\u00EE", "i");
975                 UNICODE_CHARS.put("\u00EF", "i");
976                 UNICODE_CHARS.put("\u00F0", "o");
977                 UNICODE_CHARS.put("\u00F1", "n");
978                 UNICODE_CHARS.put("\u00F2", "o");
979                 UNICODE_CHARS.put("\u00F3", "o");
980                 UNICODE_CHARS.put("\u00F4", "o");
981                 UNICODE_CHARS.put("\u00F5", "o");
982                 UNICODE_CHARS.put("\u00F6", "oe");
983                 UNICODE_CHARS.put("\u00F8", "oe");
984                 UNICODE_CHARS.put("\u00F9", "u");
985                 UNICODE_CHARS.put("\u00FA", "u");
986                 UNICODE_CHARS.put("\u00FB", "u");
987                 UNICODE_CHARS.put("\u00FC", "ue"); // u umlaut...
988                 UNICODE_CHARS.put("\u00FD", "y");
989                 UNICODE_CHARS.put("\u00FF", "y");
990                 UNICODE_CHARS.put("\u0100", "A");
991                 UNICODE_CHARS.put("\u0101", "a");
992                 UNICODE_CHARS.put("\u0102", "A");
993                 UNICODE_CHARS.put("\u0103", "a");
994                 UNICODE_CHARS.put("\u0104", "A");
995                 UNICODE_CHARS.put("\u0105", "a");
996                 UNICODE_CHARS.put("\u0106", "C");
997                 UNICODE_CHARS.put("\u0107", "c");
998                 UNICODE_CHARS.put("\u0108", "C");
999                 UNICODE_CHARS.put("\u0109", "c");
1000                 UNICODE_CHARS.put("\u010A", "C");
1001                 UNICODE_CHARS.put("\u010B", "c");
1002                 UNICODE_CHARS.put("\u010C", "C");
1003                 UNICODE_CHARS.put("\u010D", "c");
1004                 UNICODE_CHARS.put("\u010E", "D");
1005                 UNICODE_CHARS.put("\u010F", "d");
1006                 UNICODE_CHARS.put("\u0110", "D");
1007                 UNICODE_CHARS.put("\u0111", "d");
1008                 UNICODE_CHARS.put("\u0112", "E");
1009                 UNICODE_CHARS.put("\u0113", "e");
1010                 UNICODE_CHARS.put("\u0114", "E");
1011                 UNICODE_CHARS.put("\u0115", "e");
1012                 UNICODE_CHARS.put("\u0116", "E");
1013                 UNICODE_CHARS.put("\u0117", "e");
1014                 UNICODE_CHARS.put("\u0118", "E");
1015                 UNICODE_CHARS.put("\u0119", "e");
1016                 UNICODE_CHARS.put("\u011A", "E");
1017                 UNICODE_CHARS.put("\u011B", "e");
1018                 UNICODE_CHARS.put("\u011C", "G");
1019                 UNICODE_CHARS.put("\u011D", "g");
1020                 UNICODE_CHARS.put("\u011E", "G");
1021                 UNICODE_CHARS.put("\u011F", "g");
1022                 UNICODE_CHARS.put("\u0120", "G");
1023                 UNICODE_CHARS.put("\u0121", "g");
1024                 UNICODE_CHARS.put("\u0122", "G");
1025                 UNICODE_CHARS.put("\u0123", "g");
1026                 UNICODE_CHARS.put("\u0124", "H");
1027                 UNICODE_CHARS.put("\u0125", "h");
1028                 UNICODE_CHARS.put("\u0127", "h");
1029                 UNICODE_CHARS.put("\u0128", "I");
1030                 UNICODE_CHARS.put("\u0129", "i");
1031                 UNICODE_CHARS.put("\u012A", "I");
1032                 UNICODE_CHARS.put("\u012B", "i");
1033                 UNICODE_CHARS.put("\u012C", "I");
1034                 UNICODE_CHARS.put("\u012D", "i");
1035                 // UNICODE_CHARS.put("\u0100", "");
1036
1037                 RTFCHARS.put("`a", "\\'e0");
1038                 RTFCHARS.put("`e", "\\'e8");
1039                 RTFCHARS.put("`i", "\\'ec");
1040                 RTFCHARS.put("`o", "\\'f2");
1041                 RTFCHARS.put("`u", "\\'f9");
1042                 RTFCHARS.put("?a", "\\'e1");
1043                 RTFCHARS.put("?e", "\\'e9");
1044                 RTFCHARS.put("?i", "\\'ed");
1045                 RTFCHARS.put("?o", "\\'f3");
1046                 RTFCHARS.put("?u", "\\'fa");
1047                 RTFCHARS.put("^a", "\\'e2");
1048                 RTFCHARS.put("^e", "\\'ea");
1049                 RTFCHARS.put("^i", "\\'ee");
1050                 RTFCHARS.put("^o", "\\'f4");
1051                 RTFCHARS.put("^u", "\\'fa");
1052                 RTFCHARS.put("\"a", "\\'e4");
1053                 RTFCHARS.put("\"e", "\\'eb");
1054                 RTFCHARS.put("\"i", "\\'ef");
1055                 RTFCHARS.put("\"o", "\\'f6");
1056                 RTFCHARS.put("\"u", "\\u252u");
1057                 RTFCHARS.put("~n", "\\'f1");
1058                 RTFCHARS.put("`A", "\\'c0");
1059                 RTFCHARS.put("`E", "\\'c8");
1060                 RTFCHARS.put("`I", "\\'cc");
1061                 RTFCHARS.put("`O", "\\'d2");
1062                 RTFCHARS.put("`U", "\\'d9");
1063                 RTFCHARS.put("?A", "\\'c1");
1064                 RTFCHARS.put("?E", "\\'c9");
1065                 RTFCHARS.put("?I", "\\'cd");
1066                 RTFCHARS.put("?O", "\\'d3");
1067                 RTFCHARS.put("?U", "\\'da");
1068                 RTFCHARS.put("^A", "\\'c2");
1069                 RTFCHARS.put("^E", "\\'ca");
1070                 RTFCHARS.put("^I", "\\'ce");
1071                 RTFCHARS.put("^O", "\\'d4");
1072                 RTFCHARS.put("^U", "\\'db");
1073                 RTFCHARS.put("\"A", "\\'c4");
1074                 RTFCHARS.put("\"E", "\\'cb");
1075                 RTFCHARS.put("\"I", "\\'cf");
1076                 RTFCHARS.put("\"O", "\\'d6");
1077                 RTFCHARS.put("\"U", "\\'dc");
1078                 
1079                 // Use UNICODE characters for RTF-Chars which can not be found in the
1080                 // standard codepage
1081
1082                 // RTFCHARS.put("`A", "\\u192"); // "Agrave" exists in standard
1083                 // codepage
1084                 RTFCHARS.put("'A", "\\u193A"); // "Aacute"
1085                 // RTFCHARS.put("^A", "\\u194"); // "Acirc" exists in standard
1086                 // codepage
1087                 RTFCHARS.put("~A", "\\u195A"); // "Atilde"
1088                 // RTFCHARS.put("\"A", "\\u196"); // "Auml" exists in standard
1089                 // codepage
1090                 RTFCHARS.put("AA", "\\u197A"); // "Aring"
1091                 RTFCHARS.put("AE", "{\\uc2\\u198AE}"); // "AElig"
1092                 RTFCHARS.put("cC", "\\u199C"); // "Ccedil"
1093                 // RTFCHARS.put("`E", "\\u200"); // "Egrave" exists in standard
1094                 // codepage
1095                 RTFCHARS.put("'E", "\\u201E"); // "Eacute"
1096                 // RTFCHARS.put("^E", "\\u202"); // "Ecirc" exists in standard
1097                 // codepage
1098                 // RTFCHARS.put("\"E", "\\u203"); // "Euml" exists in standard
1099                 // codepage
1100                 // RTFCHARS.put("`I", "\\u204"); // "Igrave" exists in standard
1101                 // codepage
1102                 RTFCHARS.put("'I", "\\u205I"); // "Iacute"
1103                 // RTFCHARS.put("^I", "\\u206"); // "Icirc" exists in standard
1104                 // codepage
1105                 // RTFCHARS.put("\"I", "\\u207"); // "Iuml" exists in standard
1106                 // codepage
1107                 RTFCHARS.put("DH", "\\u208D"); // "ETH"
1108                 RTFCHARS.put("~N", "\\u209N"); // "Ntilde"
1109                 // RTFCHARS.put("`O", "\\u210"); // "Ograve" exists in standard
1110                 // codepage
1111                 RTFCHARS.put("'O", "\\u211O"); // "Oacute"
1112                 // RTFCHARS.put("^O", "\\u212"); // "Ocirc" exists in standard
1113                 // codepage
1114                 RTFCHARS.put("~O", "\\u213O"); // "Otilde"
1115                 // RTFCHARS.put("\"O", "\\u214"); // "Ouml" exists in standard
1116                 // codepage
1117                 // According to ISO 8859-1 the "\times" symbol should be placed here
1118                 // (#215).
1119                 // Omitting this, because it is a mathematical symbol.
1120                 RTFCHARS.put("O", "\\u216O"); // "OSlash"
1121                 // RTFCHARS.put("`U", "\\u217"); // "Ugrave" exists in standard
1122                 // codepage
1123                 RTFCHARS.put("'U", "\\u218U"); // "Uacute"
1124                 // RTFCHARS.put("^U", "\\u219"); // "Ucirc" exists in standard
1125                 // codepage
1126                 // RTFCHARS.put("\"U", "\\u220"); // "Uuml" exists in standard
1127                 // codepage
1128                 RTFCHARS.put("'Y", "\\u221Y"); // "Yacute"
1129                 RTFCHARS.put("TH", "{\\uc2\\u222TH}"); // "THORN"
1130                 RTFCHARS.put("ss", "{\\uc2\\u223ss"); // "szlig"
1131                 // RTFCHARS.put("`a", "\\u224"); // "agrave" exists in standard
1132                 // codepage
1133                 RTFCHARS.put("'a", "\\u225a"); // "aacute"
1134                 // RTFCHARS.put("^a", "\\u226"); // "acirc" exists in standard
1135                 // codepage
1136                 RTFCHARS.put("~a", "\\u227a"); // "atilde"
1137                 // RTFCHARS.put("\"a", "\\u228"); // "auml" exists in standard
1138                 // codepage
1139                 RTFCHARS.put("aa", "\\u229a"); // "aring"
1140                 RTFCHARS.put("ae", "{\\uc2\\u230ae}"); // "aelig"
1141                 RTFCHARS.put("cc", "\\u231c"); // "ccedil"
1142                 // RTFCHARS.put("`e", "\\u232"); // "egrave" exists in standard
1143                 // codepage
1144                 RTFCHARS.put("'e", "\\u233e"); // "eacute"
1145                 // RTFCHARS.put("^e", "\\u234"); // "ecirc" exists in standard
1146                 // codepage
1147                 // RTFCHARS.put("\"e", "\\u235"); // "euml" exists in standard
1148                 // codepage
1149                 // RTFCHARS.put("`i", "\\u236"); // "igrave" exists in standard
1150                 // codepage
1151                 RTFCHARS.put("'i", "\\u237i"); // "iacute"
1152                 // RTFCHARS.put("^i", "\\u238"); // "icirc" exists in standard
1153                 // codepage
1154                 // RTFCHARS.put("\"i", "\\u239"); // "iuml" exists in standard
1155                 // codepage
1156                 RTFCHARS.put("dh", "\\u240d"); // "eth"
1157                 // RTFCHARS.put("~n", "\\u241"); // "ntilde" exists in standard
1158                 // codepage
1159                 // RTFCHARS.put("`o", "\\u242"); // "ograve" exists in standard
1160                 // codepage
1161                 RTFCHARS.put("'o", "\\u243o"); // "oacute"
1162                 // RTFCHARS.put("^o", "\\u244"); // "ocirc" exists in standard
1163                 // codepage
1164                 RTFCHARS.put("~o", "\\u245o"); // "otilde"
1165                 // RTFCHARS.put("\"o", "\\u246"); // "ouml" exists in standard
1166                 // codepage
1167                 // According to ISO 8859-1 the "\div" symbol should be placed here
1168                 // (#247).
1169                 // Omitting this, because it is a mathematical symbol.
1170                 RTFCHARS.put("o", "\\u248o"); // "oslash"
1171                 // RTFCHARS.put("`u", "\\u249"); // "ugrave" exists in standard
1172                 // codepage
1173                 RTFCHARS.put("'u", "\\u250u"); // "uacute"
1174                 // RTFCHARS.put("^u", "\\u251"); // "ucirc" exists in standard
1175                 // codepage
1176                 // RTFCHARS.put("\"u", "\\u252"); // "uuml" exists in standard
1177                 // codepage
1178                 RTFCHARS.put("'y", "\\u253y"); // "yacute"
1179                 RTFCHARS.put("th", "{\\uc2\\u254th}"); // "thorn"
1180                 RTFCHARS.put("\"y", "\\u255y"); // "yuml"
1181
1182                 RTFCHARS.put("=A", "\\u256A"); // "Amacr"
1183                 RTFCHARS.put("=a", "\\u257a"); // "amacr"
1184                 RTFCHARS.put("uA", "\\u258A"); // "Abreve"
1185                 RTFCHARS.put("ua", "\\u259a"); // "abreve"
1186                 RTFCHARS.put("kA", "\\u260A"); // "Aogon"
1187                 RTFCHARS.put("ka", "\\u261a"); // "aogon"
1188                 RTFCHARS.put("'C", "\\u262C"); // "Cacute"
1189                 RTFCHARS.put("'c", "\\u263c"); // "cacute"
1190                 RTFCHARS.put("^C", "\\u264C"); // "Ccirc"
1191                 RTFCHARS.put("^c", "\\u265c"); // "ccirc"
1192                 RTFCHARS.put(".C", "\\u266C"); // "Cdot"
1193                 RTFCHARS.put(".c", "\\u267c"); // "cdot"
1194                 RTFCHARS.put("vC", "\\u268C"); // "Ccaron"
1195                 RTFCHARS.put("vc", "\\u269c"); // "ccaron"
1196                 RTFCHARS.put("vD", "\\u270D"); // "Dcaron"
1197                 // Symbol #271 (d´) has no special Latex command
1198                 RTFCHARS.put("DJ", "\\u272D"); // "Dstrok"
1199                 RTFCHARS.put("dj", "\\u273d"); // "dstrok"
1200                 RTFCHARS.put("=E", "\\u274E"); // "Emacr"
1201                 RTFCHARS.put("=e", "\\u275e"); // "emacr"
1202                 RTFCHARS.put("uE", "\\u276E"); // "Ebreve"
1203                 RTFCHARS.put("ue", "\\u277e"); // "ebreve"
1204                 RTFCHARS.put(".E", "\\u278E"); // "Edot"
1205                 RTFCHARS.put(".e", "\\u279e"); // "edot"
1206                 RTFCHARS.put("kE", "\\u280E"); // "Eogon"
1207                 RTFCHARS.put("ke", "\\u281e"); // "eogon"
1208                 RTFCHARS.put("vE", "\\u282E"); // "Ecaron"
1209                 RTFCHARS.put("ve", "\\u283e"); // "ecaron"
1210                 RTFCHARS.put("^G", "\\u284G"); // "Gcirc"
1211                 RTFCHARS.put("^g", "\\u285g"); // "gcirc"
1212                 RTFCHARS.put("uG", "\\u286G"); // "Gbreve"
1213                 RTFCHARS.put("ug", "\\u287g"); // "gbreve"
1214                 RTFCHARS.put(".G", "\\u288G"); // "Gdot"
1215                 RTFCHARS.put(".g", "\\u289g"); // "gdot"
1216                 RTFCHARS.put("cG", "\\u290G"); // "Gcedil"
1217                 RTFCHARS.put("'g", "\\u291g"); // "gacute"
1218                 RTFCHARS.put("^H", "\\u292H"); // "Hcirc"
1219                 RTFCHARS.put("^h", "\\u293h"); // "hcirc"
1220                 RTFCHARS.put("Hstrok", "\\u294H"); // "Hstrok"
1221                 RTFCHARS.put("hstrok", "\\u295h"); // "hstrok"
1222                 RTFCHARS.put("~I", "\\u296I"); // "Itilde"
1223                 RTFCHARS.put("~i", "\\u297i"); // "itilde"
1224                 RTFCHARS.put("=I", "\\u298I"); // "Imacr"
1225                 RTFCHARS.put("=i", "\\u299i"); // "imacr"
1226                 RTFCHARS.put("uI", "\\u300I"); // "Ibreve"
1227                 RTFCHARS.put("ui", "\\u301i"); // "ibreve"
1228                 RTFCHARS.put("kI", "\\u302I"); // "Iogon"
1229                 RTFCHARS.put("ki", "\\u303i"); // "iogon"
1230                 RTFCHARS.put(".I", "\\u304I"); // "Idot"
1231                 RTFCHARS.put("i", "\\u305i"); // "inodot"
1232                 // Symbol #306 (IJ) has no special Latex command
1233                 // Symbol #307 (ij) has no special Latex command
1234                 RTFCHARS.put("^J", "\\u308J"); // "Jcirc"
1235                 RTFCHARS.put("^j", "\\u309j"); // "jcirc"
1236                 RTFCHARS.put("cK", "\\u310K"); // "Kcedil"
1237                 RTFCHARS.put("ck", "\\u311k"); // "kcedil"
1238                 // Symbol #312 (k) has no special Latex command
1239                 RTFCHARS.put("'L", "\\u313L"); // "Lacute"
1240                 RTFCHARS.put("'l", "\\u314l"); // "lacute"
1241                 RTFCHARS.put("cL", "\\u315L"); // "Lcedil"
1242                 RTFCHARS.put("cl", "\\u316l"); // "lcedil"
1243                 // Symbol #317 (L´) has no special Latex command
1244                 // Symbol #318 (l´) has no special Latex command
1245                 RTFCHARS.put("Lmidot", "\\u319L"); // "Lmidot"
1246                 RTFCHARS.put("lmidot", "\\u320l"); // "lmidot"
1247                 RTFCHARS.put("L", "\\u321L"); // "Lstrok"
1248                 RTFCHARS.put("l", "\\u322l"); // "lstrok"
1249                 RTFCHARS.put("'N", "\\u323N"); // "Nacute"
1250                 RTFCHARS.put("'n", "\\u324n"); // "nacute"
1251                 RTFCHARS.put("cN", "\\u325N"); // "Ncedil"
1252                 RTFCHARS.put("cn", "\\u326n"); // "ncedil"
1253                 RTFCHARS.put("vN", "\\u327N"); // "Ncaron"
1254                 RTFCHARS.put("vn", "\\u328n"); // "ncaron"
1255                 // Symbol #329 (´n) has no special Latex command
1256                 RTFCHARS.put("NG", "\\u330G"); // "ENG"
1257                 RTFCHARS.put("ng", "\\u331g"); // "eng"
1258                 RTFCHARS.put("=O", "\\u332O"); // "Omacr"
1259                 RTFCHARS.put("=o", "\\u333o"); // "omacr"
1260                 RTFCHARS.put("uO", "\\u334O"); // "Obreve"
1261                 RTFCHARS.put("uo", "\\u335o"); // "obreve"
1262                 RTFCHARS.put("HO", "\\u336?"); // "Odblac"
1263                 RTFCHARS.put("Ho", "\\u337?"); // "odblac"
1264                 RTFCHARS.put("OE", "{\\uc2\\u338OE}"); // "OElig"
1265                 RTFCHARS.put("oe", "{\\uc2\\u339oe}"); // "oelig"
1266                 RTFCHARS.put("'R", "\\u340R"); // "Racute"
1267                 RTFCHARS.put("'r", "\\u341r"); // "racute"
1268                 RTFCHARS.put("cR", "\\u342R"); // "Rcedil"
1269                 RTFCHARS.put("cr", "\\u343r"); // "rcedil"
1270                 RTFCHARS.put("vR", "\\u344R"); // "Rcaron"
1271                 RTFCHARS.put("vr", "\\u345r"); // "rcaron"
1272                 RTFCHARS.put("'S", "\\u346S"); // "Sacute"
1273                 RTFCHARS.put("'s", "\\u347s"); // "sacute"
1274                 RTFCHARS.put("^S", "\\u348S"); // "Scirc"
1275                 RTFCHARS.put("^s", "\\u349s"); // "scirc"
1276                 RTFCHARS.put("cS", "\\u350S"); // "Scedil"
1277                 RTFCHARS.put("cs", "\\u351s"); // "scedil"
1278                 RTFCHARS.put("vS", "\\u352S"); // "Scaron"
1279                 RTFCHARS.put("vs", "\\u353s"); // "scaron"
1280                 RTFCHARS.put("cT", "\\u354T"); // "Tcedil"
1281                 RTFCHARS.put("ct", "\\u355t"); // "tcedil"
1282                 RTFCHARS.put("vT", "\\u356T"); // "Tcaron"
1283                 // Symbol #357 (t´) has no special Latex command
1284                 RTFCHARS.put("Tstrok", "\\u358T"); // "Tstrok"
1285                 RTFCHARS.put("tstrok", "\\u359t"); // "tstrok"
1286                 RTFCHARS.put("~U", "\\u360U"); // "Utilde"
1287                 RTFCHARS.put("~u", "\\u361u"); // "utilde"
1288                 RTFCHARS.put("=U", "\\u362U"); // "Umacr"
1289                 RTFCHARS.put("=u", "\\u363u"); // "umacr"
1290                 RTFCHARS.put("uU", "\\u364U"); // "Ubreve"
1291                 RTFCHARS.put("uu", "\\u365u"); // "ubreve"
1292                 RTFCHARS.put("rU", "\\u366U"); // "Uring"
1293                 RTFCHARS.put("ru", "\\u367u"); // "uring"
1294                 RTFCHARS.put("HU", "\\u368?"); // "Odblac"
1295                 RTFCHARS.put("Hu", "\\u369?"); // "odblac"
1296                 RTFCHARS.put("kU", "\\u370U"); // "Uogon"
1297                 RTFCHARS.put("ku", "\\u371u"); // "uogon"
1298                 RTFCHARS.put("^W", "\\u372W"); // "Wcirc"
1299                 RTFCHARS.put("^w", "\\u373w"); // "wcirc"
1300                 RTFCHARS.put("^Y", "\\u374Y"); // "Ycirc"
1301                 RTFCHARS.put("^y", "\\u375y"); // "ycirc"
1302                 RTFCHARS.put("\"Y","\\u376Y"); // "Yuml"
1303                 RTFCHARS.put("'Z", "\\u377Z"); // "Zacute"
1304                 RTFCHARS.put("'z", "\\u378z"); // "zacute"
1305                 RTFCHARS.put(".Z", "\\u379Z"); // "Zdot"
1306                 RTFCHARS.put(".z", "\\u380z"); // "zdot"
1307                 RTFCHARS.put("vZ", "\\u381Z"); // "Zcaron"
1308                 RTFCHARS.put("vz", "\\u382z"); // "zcaron"
1309                 // Symbol #383 (f) has no special Latex command
1310
1311                 // XML_CHARS.put("\\u00E1", "&#x00E1;");
1312         }
1313
1314         public static void initializeJournalNames() {
1315                 journalAbbrev = new JournalAbbreviations();// "/resource/journalList.txt");
1316
1317                 // Read external lists, if any (in reverse order, so the upper lists
1318                 // override the lower):
1319                 String[] lists = prefs.getStringArray("externalJournalLists");
1320                 if ((lists != null) && (lists.length > 0)) {
1321                         for (int i = lists.length - 1; i >= 0; i--) {
1322                                 try {
1323                                         journalAbbrev.readJournalList(new File(lists[i]));
1324                                 } catch (FileNotFoundException e) {
1325                                         // The file couldn't be found... should we tell anyone?
1326                                         Globals.logger(e.getMessage());
1327                                 }
1328                         }
1329                 }
1330
1331                 // Read personal list, if set up:
1332                 if (prefs.get("personalJournalList") != null) {
1333                         try {
1334                                 journalAbbrev.readJournalList(new File(prefs.get("personalJournalList")));
1335                         } catch (FileNotFoundException e) {
1336                                 Globals.logger("Personal journal list file '" + prefs.get("personalJournalList")
1337                                         + "' not found.");
1338                         }
1339                 }
1340
1341         }
1342
1343 }