PocketBuilder supports the Unicode standard, a universal character set that encodes the characters of over 650 of the world's languages. Using a single character set to encode data in multiple languages allows you to create a single multilingual application that can process data in different languages rather than creating multiple monolingual applications.
Every application development tool encodes text in a particular character set. PocketBuilder uses Unicode UTF-16, a two-byte encoding format. Therefore, any text you enter while developing your application is in Unicode.
Working with ANSI and Unicode files outside PocketBuilder
In WordPad, you can open and save files as ANSI or Unicode.
In TextPad, you can open and save files as ANSI or Unicode, and
you can determine whether an open file is ANSI or Unicode by viewing
its properties.
This section describes how PocketBuilder handles Unicode in several areas of the product. The next two sections, “Importing and exporting DataWindow data” and “Reading and writing text or binary files”, describe how you use these techniques with particular reference to Unicode.
Some fonts do not display Unicode characters correctly or do not work appropriately on all platforms, and the number of fonts available on Pocket PC devices is limited. To ensure consistent display on all platforms, PocketBuilder uses Tahoma as its default font.
If you call external functions in your application, the functions must be defined and compiled with Unicode support. All strings must be passed as Unicode strings. You can call Windows CE API functions. For more information, see “Using external functions”.
You can convert a PocketBuilder application to a PowerBuilder application and vice versa. You must use PocketBuilder to perform both conversions. If you add characters that are not supported in ANSI environments to an application in PocketBuilder, the characters will not convert correctly to the PowerBuilder application.
For more information, see the User’s Guide.
PocketBuilder allows you to import both ANSI and Unicode files in the System Tree and Library painter. However, exported source (.sr*) files are always in Unicode format. To convert from ANSI to Unicode and from Unicode to ANSI in PocketBuilder, use the FromANSI and ToANSI functions.
To convert a Unicode file to an ANSI file so that you can use it in PowerBuilder, use the FromUnicode function in PowerBuilder. For an example, see the online Help.
PocketBuilder resource (.pkr) files can be in either Unicode or ANSI file format.
Target (.pkt) and workspace (.pkw) files are saved in ANSI format.
The Script view and the file editor accept both Unicode and ANSI file formats. New text files are saved in the Unicode file format.
The SetProfileString function writes to the text file in the format, either ANSI or Unicode, in which it was opened. To write Unicode characters to an initialization file, open and save the file as Unicode before calling SetProfileString. The ProfileInt and ProfileString functions can read from ANSI and Unicode files.
Unicode files often have two extra bytes at the start of the file to indicate that they use Unicode byte ordering. Many programs, including PocketBuilder, do not require that these two bytes be present in Unicode files. They are able to determine whether the file uses Unicode byte ordering using other methods. Additionally, many programs, including PocketBuilder, do not always add the two-byte flag to the beginning of files saved with Unicode encoding.
The Adaptive Server Anywhere ODBC driver supports either ASCII (8-bit) strings or Unicode code (wide character) strings. The UNICODE macro controls whether ODBC functions expect ASCII or Unicode strings. If your application must be built with the UNICODE macro defined, but you want to use the ASCII ODBC functions, then the SQL_NOUNICODEMAP macro must also be defined. For more information, see the ASA documentation.
Copyright © 2004. Sybase Inc. All rights reserved. |
![]() |