Language Variations; Comparing Strings And Comparing Characters; Sorting Example: C Vs. German - HP 9000 User Manual

Computers
Hide thumbs Also See for 9000:
Table of Contents

Advertisement

2
Language Variations
Comparing Strings and Comparing Characters
The order in which character strings are sorted is language-dependent. In
addition, there may be a discrepancy between a character's order within a
character set and true lexicographical (dictionary) order. Sorting based on
character code does not provide true lexicographical order even in the case of
the AS CII character set.
Lexicographical order sorts "a" after "A" and before "B", whereas
ASCII-based order sorts "a" after the entire set of uppercase letters. This
situation becomes more complex in an internationalized program that is
structured to handle many different, coded-character sets.
The following is an example of sorting the same list based on the C sorting
method, and based on a German sorting method. The table shows that while
"a"
follows "b" in the coded character set ordering, it is sorted before "b"
when sorted according to lexicographical order. This situation makes sorting
based on the code of each character inappropriate when internationalizing
software. Even within the subset of lowercase values, character set order does
not coincide with lexicographical order. In addition, characters can no longer
be up-shifted or down-shifted as in ASCII by adding or subtracting a fixed
offset.
Table 2-1. Sorting Example: C vs. German
Sorted by
Sorted by
C rules
German rules
Airplane
Airplane
Zebra
apfel
bird
bird
car
car
apfel
Zebra
Beyond the ordering of individual characters, some languages designate that
certain characters be treated in a special way. For example, in some languages
groups of characters are clustered and treated as a single character.
2-10
Introduction to NLS

Advertisement

Table of Contents
loading

Table of Contents