CharsetFactory

CharsetFactory


MARC8.CharsetFactory ($Workfile: CharsetFactory.cls $) - A class for doing MARC-8 to Unicode translation

MARC8.CharsetFactory is a class that allows you to easily convert between the MARC-8 character encodings and Unicode. The Library of Congress maintains some essential mapping tables and information about the MARC-8 and Unicode environments at: http://www.loc.gov/marc/specifications/spechome.html

Public:

Types:

NameDescription
DIAGS How to handle diagnostic warnings  
MARC8ESCAPES Make the constants used for escaping to the various MARC-8 CharSets publicly available via an enum

These would probably never be used unless a user is attempting to construct a MARC-8 string for testing  

MARCCHARSET The various MARC Character Sets supported by the CharSetFactory  

Properties:

NameDescription
Diagnostics (get) Return the level of diagnostic messages being used by the converter:  
Diagnostics (let) Set the level of diagnostic messages to be used by the converter:  
LogFile (get) Return the name of the file to which diagnostic messages are logged. If LogFile is set to an empty string diagnostics will be logged to the NT Application Event Log  
LogFile (let) Set the name of the file to which diagnostic messages are logged. If LogFile is set to an empty string diagnostics will be logged to the NT Application Event Log  

Methods:

NameDescription
G0 Returns an object representing the character set that is being used as the first graphic character set (G0). If you pass in a new CharSet object you will set the G0 character set, and as a side effect youll get the previous G0 value returned to you. You probably dont ever need to call this since character set changes are handled by the MARC8ToString function.  
G1 Returns an object representing the character set that is being used as the second graphic character set (G1). If you pass in a new CharSet object you will set the G1 character set, and as a side effect youll get the previous G1 value returned to you. You probably dont ever need to call this since character set changes are handled by the MARC8ToString function.  
GetCharSet Returns a given CharSet object.  
Initialize Initialize the default G0 and G1 charsets (using the GZero and Gone parameters, but if you dont initialize ASCII/Ansel will be assumed.

If you would like diagnostics turned on set the Diag parameter to one of Ignore, Log, or Fatal  

MARC8ToString Convert the given MARC8 byte array into a windows Unicode string (UCS-2)  
MARC8ToStringWEntities Convert the given MARC8 byte array into a windows Unicode string (UCS-2) with any characters above 127 encoded as XML character entities.  
MARC8ToUTF8 Convert the given MARC8 byte array into a byte array containing UTF-8  
StringToUTF8 Convert the given VB Unicode String into a UTF-8 byte array  
UTF8ToString Convert the given UTF-8 byte array into a VB Unicode String  
UTF8ToStringWEntities Convert the given UTF8 byte array into a windows Unicode string (UCS-2) with any characters above 127 encoded as XML character entities.