Right-To-Left Unicode Strings; Sending Strings To A User Interface - AMX NetLinx Studio Instruction Manual

Netlinx design v3.3 or higher
Table of Contents

Advertisement

Programming
When reading or appending to file, the file format is automatically determined when the file is opened. You can pass in a
variable to WC_FILE_OPEN and the function will set the variable to the file format that was detected. When writing
files, the file format parameter will determine how data is written to the file. The following constants can be used for
specifying or checking the file format: WC_FORMAT_UNICODE, WC_FORMAT_UNICODE_BE, WC_FORMAT_UTF8.
The Unicode file format, specified by the constant WC_FORMAT_UNICODE, is the fastest to encode and decode. You
should use this format unless you have a particular application that requires either UTF-8 or Unicode BE encoding.
The WC_FILE_READ/WRITE functions take the number of characters that will be read or written to the file. However,
the functions return the number of bytes read or written to the file, not the number of characters. For Unicode and
Unicode BE encoding, there are 2 bytes for every character. For UTF-8 encoding, the number of bytes for every
character varies depending on the character.
Unicode filenames are not supported. The parameter for the file name is a CHAR array. Always use a non-Unicode name
for the file.
The following file functions support WIDECHAR arrays:
WC_FILE_OPEN
WC_FILE_CLOSE
WC_FILE_READ
WC_FILE_READ_LINE
WC_FILE_WRITE
WC_FILE_WRITE_LINE

Right-to-Left Unicode Strings

Right-to-Left Unicode languages are stored in memory the same way left-to-right language are. The first memory
position of an array contains the first logical character. You can access the right-most character of a Right-to-Left
Unicode string using this notation:
wchChar = wcString[1]
Right-to-left languages are not stored differently than left-to-right languages, they are simply rendered differently than
right to left languages.
However, note that the functions WC_LEFT_STRING and WC_RIGHT_STRING remove a number of characters from
the start and end of a string respectively. Using WC_LEFT_STRING on a right-to-left language will return the number of
right-most, i.e. first, characters you requested, not the left-most, i.e. end, characters.
WC_LEFT_STRING returns the number of characters request from the front of the string and WC_RIGHT_STRING
return the number of characters requested from the end of the string, regardless of the language's orientation.

Sending Strings to a User Interface

Sending a WIDECHAR array to a user interface is accomplished using WC_TP_ENCODE. WC_TP_ENCODE takes a
WIDECHAR array and returns a CHAR array formatted for a user interface UNI or BAU command.
cMyString = WC_TP_ENCODE(wcMyString)
SEND_COMMAND dvTP,"'^UNI-1,0,',cMyString "
102
NetLinx Studio - Instruction Manual

Advertisement

Table of Contents
loading

Table of Contents