Re: CW2TEX not working in Win 2000 [Urgent]
Why do you _want_ to struggle with the nightmare that code
pages are? Why don't you simply code everything in UNICODE?
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"ss2905" <ss2905@gmail.com> wrote in message
news:1154444111.382883.192570@b28g2000cwb.googlegroups.com...
Hello all,
I have a ATL COM object being used by JavaScript code.
The component has to support English as well as Japanese.
I have a function which accepts a filename as BSTR. Internally, I have
to convert it to LPCTSTR for further use.
I use ATL 7.0 CW2TEX conversion class
The code looks like
-----------------------------------
LPCTSTR l_pszFileName = NULL;
CW2TEX <> l_pszFileName (f_bstrFileName);
-----------------------------------
When the file name contains single byte space, the conversion is not
proper on Win 2000.
for eg. "This file name has spaces.txt" is converted as
"This?file?name?has?spaces.txt"
Double byte spaces within Japanese filenames are converted properly.
Moreover, on Windows XP, the is no problem with the conversion of
filenames having single or double byte spaces.
I have been through the previous mailing lists in this group and have
tried
_bstr_t, ConvertBSTRToString, OLE2T, OLE2W.
However, I am unable to find a proper solution.
Best results were obtained with OLE2W. But then, the MessageBox API
does not print the converted text properly. Since I receive file names
and error messages from the user of my control, I have to use
CreateFile and MessageBox APIs internally.
Is there some known problem with CW2TEX class?
I have to support Win 98 also.
Am I missing something in my project settings? Currently, the project
is set to the default "Use MBCS" option. I am using Visual Studio .NET
2003.
On my Win XP machine, the result of GetCP() was 1252 ( Latin - 1)
On the Windows 2000 machine, GetCP() returned 932 ( Shift_JIS )
Any help is welcome.
Regards,
ss2905