HP 9000 User Manual page 106

Computers
Hide thumbs Also See for 9000:
Table of Contents

Advertisement

Guidelines for Creating Internationalized Programs
• Whenever possible, use the WPI to handle character data. This allows
a single-compiled application to handle all system-supported single- and
multi-byte character encodings.
• Always maintain data integrity. Do not do any processing or examining of
character data if you do not have to. If you are simply passing data through
a routine or application, do not zero out the high bit of each byte, or pad it
into even-sized blocks, or substitute linefeeds for carriage returns, etc.
• Never use the 8th bit of a character byte as a flag. This was a practice that
grew out of the fact the ASCII is a 7-bit code. It is no longer acceptable.
• Never hardcode character constants. The run-time character set may be
different from the compile-time character set. Comparing against a character
constant may not work if the character has a different code in the run-time
environment than it did in the compile-time environment. This is especially
likely for characters not found in the ASCII set. If it is possible to put these
values in files, where they can be changed, do so. If not, at least assign
symbolic names to them (like slash) so it will be easy to track down and
change such codeset-dependent information later. Likewise, do not hardcode
6
numeric constants to represent characters (like decimal 32 for "space").
• Never use "ASCII" rules for character transformation or identification.
Upshifting characters by adding decimal 32, or testing for alphabetic
characters by comparing against numeric range, will probably not work
for non-ASCII character sets. Use system-supplied language/character-set
sensitive routines for identifying or up/down shifting characters.
• When sorting data for end-user viewing, do not use numeric comparisons
of strings or characters for collation. System routines exist for the
proper, language-sensitive, collation of text strings. The only cases where
comparisons based on character's numeric representations should be used
are when testing two strings for equality, or for hash tables, b-trees, etc.,
which are never directly viewed or accessed by end-users. In these cases the
higher-performing, numeric comparisons may be appropriate.
Developing International Software
6·29

Advertisement

Table of Contents
loading

Table of Contents