Using Standard Names and MIB enums (SNM)

Internet names, standard names and MIB enums (SNM) are widely used for character sets. This section describes how to use these names and values during character conversion.

Before you start, you must understand:

Introduction

To convert text between a foreign encoding and Unicode you must know the UID of the character converter.

Device creators can create files which map SNM information of character sets to the UIDs of their character converters. Application developers can then use the MIB enum value or an alias of a character set without knowing its UID.

Procedure

Creating an SNM source file

Device creators can create an SNM mapping file in the ROM as follows:

  1. Create an SNM source file using a text editor on a PC and save it. For example d:\charconvfiles\basicsnm.txt.

    This file must define the mapping between Symbian-specific character set UIDs and one or more standard names and MIB enums. Refer to SNM Source File Reference for the file syntax. For information about Symbian UIDs, refer to the charconv.h header file.

    
    ...
    CharacterSet 0x10004cc6
        StandardName    "US-ASCII"
        StandardName    "ASCII"
        StandardName    "ANSI_X3.4-1968"
        StandardName    "iso-ir-6"
        StandardName    "ANSI_X3.4-1986"
        StandardName    "ISO_646.irv:1991"
        StandardName    "ISO646-US"
        StandardName    "us"
        StandardName    "IBM367"
        StandardName    "cp367"
        StandardName    "csASCII"
        MibEnum            3
    
    CharacterSet 0x10003b10
        StandardName    "ISO-8859-1"
        StandardName    "ISO_8859-1"
        StandardName    "latin1"
        StandardName    "iso-ir-100"
        StandardName    "l1"
        StandardName    "IBM819"
        StandardName    "CP819"
        StandardName    "csISOLatin1"
        MibEnum            4
    ...
    
  2. Use the snmtool to generate an SNM file from the source SNM file.

    From a command line, run the following commands to go to the Symbian tools directory and execute snmtool:

    cd d:\Symbian\epoc32\tools

    snmtool.bat d:\charconvfiles\basicsnm.txt d:\charconvfiles\basic.snm

  3. Copy the SNM file to the \system\charconv\ directory.

Retrieving a Character Converter UID using an SNM standard name or MIB enum

  1. Use an SNM standard name or MIB enum value to retrieve the UID of the character converter.

    RFs fileServerSession;
    CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewLC();
    
    TUint characterSetUid = 
        characterSetConverter->ConvertStandardNameOfCharacterSetToIdentifierL(_L8("ASCII"), fileServerSession);
    
        // use the UID to load the converter.
    CCnvCharacterSetConverter::TAvailability available = 
        characterSetConverter->PrepareToConvertToOrFromL(characterSetUid, fileServerSession);
    ...

There are two functions for getting a UID:

  • CCnvCharacterSetConverter::ConvertStandardNameOfCharacterSetToIdentifierL() takes a standard name as a parameter.

  • CCnvCharacterSetConverter::ConvertMibEnumOfCharacterSetToIdentifierL() takes a MIB enum value as a parameter.

These functions read the SNM file to get the UID. The UID can then be passed to PrepareToConvertToOrFromL() to load the right converter.

Note: If there are multiple SNM files, the contents are combined.