Guardian Procedure Calls Reference Manual (G06.25+)
Guardian Procedure Calls (M)
Guardian Procedure Calls Reference Manual—522629-013
9-6
MBCS_CHAR_ Procedure
<8:15> contains the internal size (in bytes) of the multibyte character
identified by the test.
when
result is zero, charinfo contains one of the following values
indicating the cause of failure of the MBCS_CHAR_ test:
0 No reported error; tested character is a 1-byte character
29 Required parameter missing
-2 An unknown character set was specified
Considerations
•
Tests are provided for HP Kanji (Shift-JIS), HP Hangul, HP Chinese Big 5, HP
Chinese PC and HP Korean KSC5601 format MBCS. HP Kanji is the standard
internal representation used by HP for the character set defined in the JIS X0208
standard (formerly JIS C6226). Chinese Big 5 is a character set defined by
vendors in Taiwan. Chinese PC is the character set used by IBM on Chinese PCs.
HP Hangul support is provided for the Korean character set in use by KIPS on HP
6526 terminals as well as for the new standard Hangul (KSC 5601) character set.
All MBCSs are similar in format and are suitable for internal representation of the
multibyte character set in conjunction with an ASCII-like 1-byte character set.
•
In most supported MBCS schemes, single-byte values have multiple- character
identities. For example, in the HP Kanji MBCS format, all ASCII alphabetic and all
1-byte Japanese Katakana characters also appear within HP Kanji MBCS
characters. Furthermore, all byte values which appear as the first byte of HP Kanji
characters might also appear in the second byte of HP Kanji characters. Similar
ambiguous usage of individual byte values occurs in other supported MBCSs.
Proper character identification depends both on value range testing and context.
Because of the multiple identity of individual byte values, it is not safe to attempt to
identify characters selected at random from a text string. Proper character
identification requires analysis of text strings from a starting location with known
conditions. Character analysis must begin on a byte position that is known to be
either a 1-byte character or the first byte of a multibyte character.
•
To obtain correct results, supply a valid starting point and ensure legitimate access
to the text buffer. Text strings should begin only with a 1-byte character or with the
first byte of a multibyte character. Thus, you can call the MBCS_CHAR_
procedure with the
testmbcschar parameter set to the address of the first byte of
a text string. Subsequent calls to test other locations within the text string must be
based upon the results of the initial and succeeding calls, with the
testmbcschar
pointer being advanced by the size of the character found, following each call to
MBCS_CHAR_. The following code sample illustrates the proper use of the
MBCS_CHAR_ procedure:
@testmbcschar := @first byte in text string;
WHILE processing mixed text string
DO
BEGIN --text string loop
charsize := number of bytes remaining in text string;
IF MBCS_CHAR_( testmbcschar, charset, charsize )