Programming
100
NetLinx Studio - Instruction Manual
Unicode Compatible Functions
The list of Unicode compatible functions is:
Converting Between WIDECHAR and CHAR
On occasion, you may need to convert a
CHAR
array to a
WIDECHAR
array or a
WIDECHAR
array to a
CHAR
array. The
CH_TO_WC
and
WC_TO_CH
functions can be used to accomplish these conversions.
For example:
wcMyString = CH_TO_WC('Any ASCII string')
wcMyString = CH_TO_WC(cMyString)
cMyString = WC_TO_CH(_WC('Any Unicode string'))
cMyString = WC_TO_CH (wcMyString)
When converting from
WIDECHAR
to
CHAR
, Unicode characters are converted to '?'.
Any ASCII or extended ASCII characters, i.e. 8-bit characters, contained in the
WIDECHAR
array will appear
in the
CHAR
array.
Converting from
CHAR
to
WIDECHAR
never results in loss of data.
Defining a Unicode String Literal
To enter Unicode characters into your program, enclose the characters in single quotes, like you would any other string,
and wrap the string literal in the Unicode macro
_WC
.
Example:
_WC('Your string goes here')
Storing a Unicode String
Unicode strings are stored in
WIDECHAR
arrays, similar to the way ASCII strings are stored in
CHAR
arrays.
To define a
WIDECHAR
constant or variable and initialize it using a Unicode string literal, use the following syntax:
WIDECHAR wcMyString[] = _WC('My String')
Character Case Mappings
Converting between upper and lower case is accomplished by using the Unicode.org character database to determine the
mapping between upper case and lower case characters.
Not all Unicode characters have an upper or lower case equivalent; these characters will not be affected by
WC_UPPER_STRING
and
WC_LOWER_STRING
. Only the characters defined by Unicode.org as having an upper or
lower case mapping are affected by these functions.
WC_COMPARE_STRING
WC_MAX_LENGTH_STRING
WC_GET_BUFFER_CHAR
WC_MID_STRING
WC_GET_BUFFER_STRING
WC_REMOVE_STRING
WC_LEFT_STRING
WC_RIGHT_STRING
WC_FIND_STRING
WC_SET_LENGTH_STRING
WC_LENGTH_STRING
WC_UPPER_STRING
WC_LOWER_STRING
All Unicode string literals must be wrapped in the _WC macro. Failing to wrap a
Unicode string in the _WC macro will result in a compiler error.
The "wc" prefix is Hungarian notation for widechar. This is simply a programming
convention and is completely optional. Hungarian notation helps you better identify
your variables while you are programming and is a general recommended standard.
For more information, see Wikipedia's Hungarian Notation page.
For more information on Unicode character conversion, see the Unicode.org
character conversion FAQ.
Summary of Contents for NetLinx Studio
Page 40: ...Working with Projects 28 NetLinx Studio Instruction Manual...
Page 148: ...Communication Settings 136 NetLinx Studio Instruction Manual...
Page 160: ...Working with Online Devices 148 NetLinx Studio Instruction Manual...
Page 178: ...File Transfer Operations 166 NetLinx Studio Instruction Manual...
Page 208: ...Tools Menu Options 196 NetLinx Studio Instruction Manual...
Page 229: ...Setting Program Preferences 217 NetLinx Studio Instruction Manual...