2.7 Testing Your Program

To verify that your code does not require any re-engineering on your part, complete the outlined steps.

  1. Scan your source code to ensure it does not contain any of the following potential internationalization problems:

    Problem

    Scan for

    Explanation

    Character Matching

    memchr

    strchr

    strcspn

    strpbrk

    strrchr

    strstr

    strtok

    These functions assume that each byte is a separate character. When matching characters in localized or user-entered strings, call the functions in nwlocale.h, which is included in NLM and NetWare Libraries for C.

    Monocasing

    memicmp

    strcmpi

    stricmp

    strncmpi

    strnicmp

    strupr

    strlwr

    toupper

    tolower

    These functions do not skip over double-byte characters. They also omit accented letters from processing. When converting case in localized or user-entered strings, call the functions in nwlocale.h, which is included in NLM and NetWare Libraries for C.

    Truncation

    strncat

    strncpy

    strnset

    These functions might split double-byte characters. When editing localized or user-entered strings, call the functions in nwlocale.h, which is included in NLM and NetWare Libraries for C.

    Date & Time

    date

    time

    Most standard C run-time date/time functions are not locale sensitive. Instead call the functions in nwlocale.h, which is included in NLM and NetWare Libraries for C.

    Single Letters

    a-z and A-Z

    Using single-quoted letters to determine whether a byte should be monocased or comparing single letters to potential double-byte characters might create a problem. Instead, use the techniques referenced in Handling Double-Byte Characters.

    Backslash

    `\\’

    \\\\

    5c

    The backslash character code (0x5C) shows up as the second byte of several Japanese and Traditional Chinese double-byte characters. When searching localized or user-entered text for the backslash character, follow the method referenced in Handling Double-Byte Characters.

    High Bit Masking

    7f

    Using hexadecimal 7F to mask bytes of localized or user-entered strings might create a problem. Make sure you follow the guidelines referenced in Handling Double-Byte Characters.

    printf

    printf

    The standard C printf family of functions doesn’t allow string insertion parameters to be reordered. When displaying localized strings that have multiple insertion parameters, call the functions in nwlocale.h, which is included in NLM and NetWare Libraries for C.