ANSI and UNICODE Conversion Problem with ODBC on Windows 98/Me

ANSI and UNICODE Conversion Problem with ODBC on Windows 98/Me

Post by Laurents C » Fri, 02 Apr 2004 22:48:36

I am developing a German-Thai-Dictionary-Software for Windows 98/Me and
Windows 2000/XP. The database with the stuff in thai and german is an MDB
and thus in UNICODE.
The Windows 2000/XP-version of the product works fine.
But in the Windows 98/Me-version appears a problem. Because the program uses
UNICODE internaly (which all works fine as well), I use parameterized
SQL-Statements to change, add and retrieve data from the database. The code
for theses operations is almost the same and works fine for adding or
changing entries.
In code, it looks about the following:

SQLBindParameter( [...], SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WCHAR, [...] );
SQLExecDirect( [...] );

I have to use parameters, because I am on Windows 98 and can not use the
SQLExecDirectW - functions, and for passing a string to the -A - functions I
had to first convert the thai-strings to ANSI, which would corrupt them. So
I have to transfer the UNICODE (WCHAR) strings somehow directly to the
database, that is why I am using parameters. This scenario works fine for
the INSERT and UPDATE statements, and the unchanged thai-strings are added
or updated in the database. But retrieving data with the SELECT statement
does not work. The statement is something like:

- with ? being replaced by the UNICODE thai search string.

What I am getting is the whole content of the database. But this scenario
works fine on Windows 2000/XP systems.

Does anybody have an idea, what the problem could be, how to solve it, or
does anybody have an different approach for making ODBC accept my WCHAR
parameters and for making ODBC using it for the SELECT statement?

Could it be, that the string is internaly (in the driver) converted from
UNICODE to ANSI while executing the SELECT statement and so maybe being
replaced by nothing or spaces? Is it possible that this happens only with
the SELECT statement and not with the INSERT and UPDATE statements (because
they are working)?

Thanks a lot in advance!!

Laurents C. R. Meyer, Software Developer, Germany, Berlin

1. Unicode to ANSI conversion problem

2. TNT Unicode Controls and Unicode on Windows 98/ME


I have started integrating the TNT controls into my app, but don't like the
fact that they cannot display Unicode on Windows 95/98/ME. I think this
limitation is unnecessary, as Unicode-support can be added on an application
basis on Windows 95/98/ME by using this library from Microsoft:

If I link with UnicoWS.lib and supply UnicoWS.dll with my application, it
should work. I would need to disable the internal 'Win32PlatformIsUnicode'
check in TNT as it only checks if the OS is minimum an NT system.

Did anybody try this?

PS. I would have posted this on the TNT webforum, but there have been no
replies to questions from the author for several weeks.


3. SendInput-ing Unicode characters to Unicode windows that have an ANSI parent

4. superclassing and unicode <-> ansi conversion

5. ansi to unicode (data conversion)

6. Unicode CString to ANSI char* conversion with proper codepage

7. VB6 ANSI to Unicode conversion wrong with fixed-length strings in structures

8. Conversion from ANSI to UNICODE errors

9. ANSI <--> Unicode conversion VB6 compliant with any codepage

10. ANSI to Unicode symbol font conversion

11. string conversion from Unicode to ANSI

12. ANSI / UNICODE conversion of Greek and Turkish in WinCE ??

13. Unicode - ansi character conversion

14. Unicode to Ansi Conversion

15. problem installing virtual pc for windows 98 on windows 98 SE