alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

package org.netbeans.modules.xml.core.lib;

import java.io.*;
import java.text.MessageFormat;
import java.util.*;
import javax.swing.text.*;
import org.netbeans.modules.xml.core.parser.ParserLoader;
import junit.framework.*;

public class EncodingHelperTest extends TestCase {
    
    static final String[] JAVA_ENCODINGS = new String[] {
       "ASCII",
       "ISO8859_1", 
       "ISO8859_2", 
       "ISO8859_3", 
       "ISO8859_4", 
       "ISO8859_5", 
       "ISO8859_6", 
       "ISO8859_7",
       "ISO8859_8",
       "ISO8859_9",
       "Big5",
       "Cp037",
       "Cp1006",
       "Cp1025",
       "Cp1026",
       "Cp1046",
       "Cp1097",
       "Cp1098",
       "Cp1112",
       "Cp1122",
       "Cp1123",
       "Cp1124",
       "Cp1250",
       "Cp1251",
       "Cp1252",
       "Cp1253",
       "Cp1254",
       "Cp1255",
       "Cp1256",
       "Cp1257",
       "Cp1258",
       "Cp1381",
       "Cp1383",
       "Cp273",
       "Cp277",
       "Cp278",
       "Cp280",
       "Cp284",
       "Cp285",
       "Cp297",
       "Cp33722",
       "Cp420",
       "Cp424",
       "Cp437",
       "Cp500",
       "Cp737",
       "Cp775",
       "Cp838",
       "Cp850",
       "Cp852",
       "Cp855",
       "Cp857",
       "Cp860",
       "Cp861",
       "Cp862",
       "Cp863",
       "Cp864",
       "Cp865",
       "Cp866",
       "Cp868",
       "Cp869",
       "Cp870",
       "Cp871",
       "Cp874",
       "Cp875",
       "Cp918",
       "Cp921",
       "Cp922",
       "Cp930",
       "Cp933",
       "Cp935",
       "Cp937",
       "Cp939",
       "Cp942",
       "Cp948",
       "Cp949",
       "Cp950",
       "Cp964",
       "Cp970",
       "EUC_CN",
       "EUC_JP",
       "EUC_KR",
       "EUC_TW",
       "GBK",
//       "ISO2022CN",  // unsupported on write     see http://developer.java.sun.com/developer/bugParade/bugs/4296969.html
//       "ISO2022CN_CNS",  // unsupported on read
//       "ISO2022CN_GB", // unsupported on read
       "ISO2022JP",
       "ISO2022KR",
       "JIS0201",
//       "JIS0208",  // cannot write '<'
//       "JIS0212",  // cannot write '<'
       "KOI8_R",
       "MS874",
       "MacArabic",
       "MacCentralEurope",
       "MacCroatian",
       "MacCyrillic",
       "MacDingbat",
       "MacGreek",
       "MacHebrew",
       "MacIceland",
       "MacRoman",
       "MacRomania",
       "MacSymbol",
       "MacThai",
       "MacTurkish",
       "MacUkraine",
       "SJIS",
       "UTF8",
       "Unicode",
       "UTF-16",
       "UnicodeLittle",
       "UnicodeLittleUnmarked",
       "UnicodeBig",
       "UnicodeBigUnmarked",
    };
    
    public EncodingHelperTest(java.lang.String testName) {
        super(testName);
    }
    
    public static void main(java.lang.String[] args) {
        junit.textui.TestRunner.run(suite());
    }
    
    public static Test suite() {
        TestSuite suite = new TestSuite(EncodingHelperTest.class);
        
        return suite;
    }
    
    
    /** Test of autoDetectEncoding method, of class org.netbeans.modules.xml.core.lib.EncodingHelper. */
    public void testEncodingDetection() throws IOException {

        // typical xml prolog with all allowed IANA encoding names
        String fmt = " ";
        String enc = null;
        
        for (int i = 0; i
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.