Rakesh API

org.rakeshv.tex
Class ISOToASCII

java.lang.Object
  extended by org.rakeshv.tex.ISOToASCII

public final class ISOToASCII
extends java.lang.Object

Implements a HashMap that maps non-ASCII ISO character entities to their plain ASCII equivalents.

See ISO Character Entities for a full description of the character entities.

Author:
Rakesh Vidyadharan on 13 January, 2002

Copyright © 2002 Rakesh Vidyadharan


Field Summary
static boolean DO_NULL_CHECK
          Specify that if no match is found for the specified character, in HashMap, return the input character as its String equivalent.
private static java.util.Map map
          The HashMap that holds the character mappings.
static boolean STRICT_ASCII
          Constant that indicates that a strict ASCII conversion is desired.
private static java.util.Map strictMap
          The HashMap that hold the strict character mappings.
 
Constructor Summary
private ISOToASCII()
          Private constructor.
 
Method Summary
static java.lang.String convertString(java.lang.String inString)
          Convert all ISO 8859-1 encoded non-ASCII characters to appropriate ASCII characters (or strings), and return the modified String object.
static java.lang.String convertString(java.lang.String inString, boolean strict)
          Convert all ISO 8859-1 encoded non-ASCII characters to appropriate ASCII characters (or strings), and return the modified String object.
static java.lang.String getASCIIEquivalent(char input)
          Returns the ASCII equivalent for the specified char.
static java.lang.String getASCIIEquivalent(char input, boolean checkFlag)
          Returns the ASCII equivalent for the specified char.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DO_NULL_CHECK

public static final boolean DO_NULL_CHECK
Specify that if no match is found for the specified character, in HashMap, return the input character as its String equivalent.

See Also:
Constant Field Values

STRICT_ASCII

public static final boolean STRICT_ASCII
Constant that indicates that a strict ASCII conversion is desired.

See Also:
Constant Field Values

map

private static java.util.Map map
The HashMap that holds the character mappings.


strictMap

private static java.util.Map strictMap
The HashMap that hold the strict character mappings.

Constructor Detail

ISOToASCII

private ISOToASCII()
Private constructor. This class cannot be instantiated.

Method Detail

getASCIIEquivalent

public static java.lang.String getASCIIEquivalent(char input)

Returns the ASCII equivalent for the specified char.

If the input character equivalent is not found, this method returns null. You will need to check the return value in your code.

Parameters:
input - - The character that is to be transformed.
Returns:
String - The ASCII equivalent.

getASCIIEquivalent

public static java.lang.String getASCIIEquivalent(char input,
                                                  boolean checkFlag)

Returns the ASCII equivalent for the specified char.

If the input character equivalent is not found, and checkFlag is specified as DO_NULL_CHECK, then, a String representation of the input character is returned.

Parameters:
input - - The character that is to be transformed.
checkFlag - - Specify that checking for existence of ASCII equivalent should be done in the method or not. To enable checking, specify DO_NULL_CHECK.
Returns:
String - The LaTeX equivalent.

convertString

public static java.lang.String convertString(java.lang.String inString)

Convert all ISO 8859-1 encoded non-ASCII characters to appropriate ASCII characters (or strings), and return the modified String object.

Parameters:
inString - - The String object that is to be modified.
Returns:
String - The modified String object.

convertString

public static java.lang.String convertString(java.lang.String inString,
                                             boolean strict)
Convert all ISO 8859-1 encoded non-ASCII characters to appropriate ASCII characters (or strings), and return the modified String object. When strict conversion is specified special characters that do not have direct ASCII equivalents, will be suppressed.

Parameters:
inString - - The String object that is to be modified.
strict - - Specified whether strict conversion is to be performed. Use STRICT_ASCII to specify preference.
Returns:
String - The modified String object.

Rakesh API

Copyright © 2002-2005 - Rakesh Vidyadharan