static public CodeSetDatabase instance()

in yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeSetDatabase.java [59:140]


    static public CodeSetDatabase instance() {
        if (instance_ == null) {
            instance_ = new CodeSetDatabase();

            //
            // Add locale specific char codesets
            //
            String locale = java.util.Locale.getDefault().getLanguage();

            if (locale.equals("C") || locale.equals("POSIX")) {
                CodeSetUtil.addCharCodeSet(ISOLATIN1);
            } else {
                String loc = locale.substring(0, 2);

                //
                // West European (C, POSIX, Germany, England, France,
                // Netherlands, Portugal)
                //
                if (loc.equals("de") || loc.equals("en") || loc.equals("fr")
                        || loc.equals("nl") || loc.equals("pt")) {
                    CodeSetUtil.addCharCodeSet(ISOLATIN1);
                }
                //
                // North European (Denmark, Finland, Island, Norway, Sweden)
                //
                else if (loc.equals("da") || loc.equals("fi")
                        || loc.equals("is") || loc.equals("no")
                        || loc.equals("sv")) {
                    CodeSetUtil.addCharCodeSet(ISOLATIN4);
                }
                //
                // South European (Italy)
                //
                else if (loc.equals("it")) {
                    CodeSetUtil.addCharCodeSet(ISOLATIN3);
                }
                //
                // East European (Czek, Hungary, Poland, Slovakia, Slovenia)
                //
                else if (loc.equals("cs") || loc.equals("hu")
                        || loc.equals("pl") || loc.equals("sk")
                        || loc.equals("sl")) {
                    CodeSetUtil.addCharCodeSet(ISOLATIN2);
                }
                //
                // Greek (Greece)
                //
                else if (loc.equals("el")) {
                    CodeSetUtil.addCharCodeSet(ISOLATIN7);
                }
                //
                // Cyrillic (Russia)
                //
                else if (loc.equals("ru")) {
                    CodeSetUtil.addCharCodeSet(ISOLATIN5);
                }
                //
                // Turkish (Turkey)
                //
                else if (loc.equals("tr")) {
                    CodeSetUtil.addCharCodeSet(ISOLATIN9);
                }
            }

            //
            // Always supported
            //
            CodeSetUtil.addCharCodeSet(PCS);

            //
            // Always supported, but only as transmission codeset
            //
            CodeSetUtil.addCharCodeSet(UTF8);

            //
            // Add the supported wchar codesets in the preferred order
            //
            CodeSetUtil.addWcharCodeSet(UTF16);
        }

        return instance_;
    }