IXFile supports Unicode in three topics: Unicode system calls, Unicode methods and Unicode text data.
Although all have Unicode in common and are often used collectively, they concern different aspects of Unicode and therefore should not be confused.
With Unicode supported, development of applications designed for international markets is simple and straightforward.
Unicode System Calls
On Windows NT, 2000 and XP Unicode is supported natively and operating system uses it exclusively for character and string manipulation
to simplify localization of software and improve multilingual text processing. Windows functions with text parameters are provided in Unicode and ANSI
versions to allow developers building both Unicode and ANSI applications.
IXFile internally calls Windows system functions to perform file operations. It uses either Unicode or ANSI version of system function depending
on method and configuration. Following methods when called with Unicode arguments result in using Windows Unicode functions:
Open, OpenAdvanced, CheckFile,
CopyFile, MoveFile, DeleteFile,
GetFolder, MakePath, SplitPath
and GetErrorDescription. All other methods - even those with Unicode parameters - do not involve Unicode system functions.
Unicode is enabled by default but can be disabled or enabled any time with EnableUnicode method.
To check current status of Unicode system calls, IsUnicodeEnabled should be called.
Unicode system calls in conjunction with Unicode methods greatly simplifies developing applications for international markets.
There is only one version of IXFile library which can be used for both Unicode and non-Unicode applications depending on your needs.
Library exposes overloaded Unicode and ANSI methods that allows C++ developers to maintain single set of sources for both character sets.
All IXFile methods with text parameters are available in overloaded versions for ANSI and Unicode character set. Both versions can be used on Unicode
and non-Unicode systems depending on your needs, because IXFile internally handles conversion to appropriate character set. Conversion between ANSI and Unicode
takes place whenever text data passed to the method has different encoding then data which this method operates on. Type of text encoding is determined solely
by functionality of the method but not by version of the method; if parameter passed to the method is encoded differently, it is converted to appropriate format.
For example when you call ANSI method for reading Unicode text, it is always read from file as Unicode and then converted to ANSI before returning to the user.
By default ANSI code page is used for conversion but SetCodePage can be called any time to change active code page.
GetCodePage method should be used to retrieve identifier of the active code page.
Unicode methods in conjunction with Unicode system calls simplifies developing applications for Unicode platforms. There is only one version
of IXFile library which can be used for both Unicode and non-Unicode applications. C++ developers can use TCHAR data type and set UNICODE
definition to switch between ANSI and Unicode character set, thus allowing the same source to be compiled to application that supports either ANSI or Unicode character set.
Visual Basic developers have only one version of IXFile methods because VB subsystem uses Unicode internally.
Although Unicode methods can be used on all systems regardless of Unicode support, some methods behave differently on Unicode and ANSI systems, as described in Unicode System Calls.
Unicode Text Data
IXFile can operate on various data types including text. Textual data can be stored in file in several formats and can have ANSI or Unicode character encoding.
Unicode text is always stored as 16 bit wide characters and ANSI text as 8 bit characters. Additional data can be also stored in file depending on text format.
Unicode text encoding solely determines type of character encoding and does not depend in any way on Unicode system calls or Unicode methods
and can be used on all platforms regardless of actual Unicode support. There are separate methods for accessing ANSI and Unicode text:
FindText and LockText operate on ANSI text;
FindUnicodeText and LockUnicodeText operate on Unicode text.
Type of text encoding is determined solely by functionality of the method but not by version (ANSI or Unicode) of the method; if parameter passed to the method is encoded differently,
it is converted to appropriate format. For example, when you call ANSI method for reading Unicode text, it is always read from file as Unicode and then converted
to ANSI before returning to the user. By default ANSI code page is used for conversion but SetCodePage can be called any time to change active code page.
int _tmain(int, _TCHAR**)
Dim ixf As IXFile
Dim txt As String
Set ixf = New IXFile