Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanGregory committed Oct 20, 2024
1 parent 67af9f6 commit 0f88787
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ch02.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ A text string in a variable or an attribute may be represented either as Unicode
Note that the ASCII one-byte character codes (hexadecimal `00`-`7F`) are a subset of UTF-8.

Before version 1.12, CF did not require text in **`char`** arrays to be encoded with UTF-8, and did not provide or endorse any convention to record what encoding was used.
If the array is stored in a variable, the encoding might be recorded by the **`_Encoding`** attribute, which is not a CF or NUG convention.
If the array is stored in a variable, the encoding might be recorded by the **`_Encoding`** attribute, although this is not a CF or NUG convention.
If the data-user has no information about the encoding, we suggest UTF-8 as a first guess.

An __n__-dimensional array of strings may be implemented as a variable or an attribute of type **`string`** with _n_ dimensions (only one dimension is allowed for an attribute) or as a variable (but not an attribute) of type **`char`** with _n_+1 dimensions, where the most rapidly varying dimension (the last dimension in CDL order) is large enough to contain the longest string in the variable.
For example, a **`char`** array containing the names of the months would be dimensioned (12,9) in order to accommodate "September", the month with the longest name.
An __n__-dimensional array of strings may be implemented as a variable or an attribute of type **`string`** with _n_ dimensions (only _n_=1 is allowed for an attribute) or as a variable of type **`char`** with _n_+1 dimensions, where the most rapidly varying dimension (the last dimension in CDL order) is large enough to contain the longest string in the variable.
For example, a **`char`** variable containing the names of the months would be dimensioned (12,9) in order to accommodate "September", the month with the longest name.
The other strings, such as "May", would be padded with trailing NULL or space characters so that every array element is filled.
A **`string`** array to store the same information would be dimensioned (12), with each element of the variable containing a string of the appropriate length.
A **`string`** variable to store the same information would be dimensioned (12), with each element of the array containing a string of the appropriate length.
The CDL example below shows one variable of each type.

[[char-and-string-variables-ex]]
Expand Down

0 comments on commit 0f88787

Please sign in to comment.