Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wicket.extensions.util.encoding;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
/**
* This class maintains a set of mappers defining mappings between locales and the corresponding
* charsets. The mappings are defined as properties between locale and charset names. The
* definitions can be listed in property files located in user's home directory, Java home directory
* or the current class jar. In addition, this class maintains static default mappings and
* constructors support application specific mappings.
*
* This source has originally been taken from the jakarta Turbine project.
*
* @author Ilkka Priha
*/
public final class CharSetMap
{
/**
* The default charset when nothing else is applicable.
*/
public static final String DEFAULT_CHARSET = "ISO-8859-1";
/**
* The name for charset mapper resources.
*/
public static final String CHARSET_RESOURCE = "charset.properties";
/**
* Priorities of available mappers.
*/
private static final int MAP_CACHE = 0;
private static final int MAP_PROG = 1;
private static final int MAP_HOME = 2;
private static final int MAP_SYS = 3;
private static final int MAP_JAR = 4;
private static final int MAP_COM = 5;
/**
* A common charset mapper for languages.
*/
private static final Map commonMapper = new HashMap();
static
{
commonMapper.put("ar", "ISO-8859-6");
commonMapper.put("be", "ISO-8859-5");
commonMapper.put("bg", "ISO-8859-5");
commonMapper.put("ca", "ISO-8859-1");
commonMapper.put("cs", "ISO-8859-2");
commonMapper.put("da", "ISO-8859-1");
commonMapper.put("de", "ISO-8859-1");
commonMapper.put("el", "ISO-8859-7");
commonMapper.put("en", "ISO-8859-1");
commonMapper.put("es", "ISO-8859-1");
commonMapper.put("et", "ISO-8859-1");
commonMapper.put("fi", "ISO-8859-1");
commonMapper.put("fr", "ISO-8859-1");
commonMapper.put("hr", "ISO-8859-2");
commonMapper.put("hu", "ISO-8859-2");
commonMapper.put("is", "ISO-8859-1");
commonMapper.put("it", "ISO-8859-1");
commonMapper.put("iw", "ISO-8859-8");
commonMapper.put("ja", "Shift_JIS");
commonMapper.put("ko", "EUC-KR");
commonMapper.put("lt", "ISO-8859-2");
commonMapper.put("lv", "ISO-8859-2");
commonMapper.put("mk", "ISO-8859-5");
commonMapper.put("nl", "ISO-8859-1");
commonMapper.put("no", "ISO-8859-1");
commonMapper.put("pl", "ISO-8859-2");
commonMapper.put("pt", "ISO-8859-1");
commonMapper.put("ro", "ISO-8859-2");
commonMapper.put("ru", "ISO-8859-5");
commonMapper.put("sh", "ISO-8859-5");
commonMapper.put("sk", "ISO-8859-2");
commonMapper.put("sl", "ISO-8859-2");
commonMapper.put("sq", "ISO-8859-2");
commonMapper.put("sr", "ISO-8859-5");
commonMapper.put("sv", "ISO-8859-1");
commonMapper.put("tr", "ISO-8859-9");
commonMapper.put("uk", "ISO-8859-5");
commonMapper.put("zh", "GB2312");
commonMapper.put("zh_TW", "Big5");
}
/**
* A collection of available charset mappers.
*/
private final List