
org.enhydra.xml.io.ISO8859CharacterSet Maven / Gradle / Ivy
The newest version!
/*
* Enhydra Java Application Server Project
*
* The contents of this file are subject to the Enhydra Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License on
* the Enhydra web site ( http://www.enhydra.org/ ).
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific terms governing rights and limitations
* under the License.
*
* The Initial Developer of the Enhydra Application Server is Lutris
* Technologies, Inc. The Enhydra Application Server and portions created
* by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
* All Rights Reserved.
*
* Contributor(s):
*
* $Id: ISO8859CharacterSet.java,v 1.2 2003/06/29 05:58:48 jkjome Exp $
*/
package org.enhydra.xml.io;
/**
* Information and operations associated with the ISO-8859-* group of character sets.
*/
class ISO8859CharacterSet extends CharacterSet {
/** Constructor */
public ISO8859CharacterSet(String name,
int charSize,
String mimePreferred,
String[] aliases) {
super(name, charSize, mimePreferred, aliases);
}
/**
* Basic implementation for ISO 8859 character sets. Considers all
* characters in the range of 0x0081 through 0x0099 to be invalid.
* Note: Acdcording to the specs, these characters are valid.
* But they are control characters and rarely ever used on purpose.
* In most cases, these characters are encountered by confusing the Windows
* CP 1252 character set with ISO-8859-1.
* @see CharacterSet#isValid
*/
public boolean isValid(char ch) {
return super.isValid(ch) && (ch <= 0x80 || ch >= 0xA0);
}
/**
* @see CharacterSet#isCompatible
*/
public boolean sameValidCharRange(CharacterSet otherSet) {
// Only valid if otherSet has the same character range and if none of
// the control characters in the rang 0x81 through 0x99 are valid in otherSet
if (!super.isCompatible(otherSet)) { return false; }
for (char c = 0x81; c < 0xA0; c++) {
if (otherSet.isValid(c)) return false;
}
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy