From: Jean on 7 Apr 2010 02:15 Hello (pure C and SDK, XP/7) I try to read a directory with cyrillic and western mixed file names. I use FindFirstFileW, WideCharToMultiByte(CP_UFT8... when i write the filename to a text file all is correct (with fwrite) when i add the filename to a listbox i get garbage, idem if i use MessageBoxA to display the filename any idea ? Jean
From: Xavier Roche on 7 Apr 2010 02:28 Jean a écrit : > when i write the filename to a text file all is correct (with fwrite) > when i add the filename to a listbox i get garbage, idem if i use > MessageBoxA to display the filename Either use MessageBoxW() or SetThreadLocale() to change the current locale with an UTF8 codepage.
From: Jean on 7 Apr 2010 02:44 I tried SetThreadLocale but it's the same effect Jean "Xavier Roche" <xroche(a)free.fr.NOSPAM.invalid> a �crit dans le message de news: hph8mu$uv7$1(a)news.httrack.net... > Jean a �crit : >> when i write the filename to a text file all is correct (with fwrite) >> when i add the filename to a listbox i get garbage, idem if i use >> MessageBoxA to display the filename > > Either use MessageBoxW() or SetThreadLocale() to change the current locale > with an UTF8 codepage.
From: Friedel Jantzen on 7 Apr 2010 13:14 Hello Jean, please post the code. Am Wed, 7 Apr 2010 08:15:46 +0200 schrieb Jean: > Hello > > (pure C and SDK, XP/7) > > I try to read a directory with cyrillic and western mixed file names. > I use FindFirstFileW, WideCharToMultiByte(CP_UFT8... > > when i write the filename to a text file all is correct (with fwrite) If you converted the strings to UTF8, you cannot add them to a Windows control. If your project is Unicode, strings must be coded UCS-2 LE (WCHAR, WideChar) to use them for the APIs. > when i add the filename to a listbox i get garbage, idem if i use > MessageBoxA to display the filename I do not understand what you mean by "idem" (English ist not my mother tongue)? All unicode APIs expect WideChar, not UTF8. Regards, Friedel
From: r_z_aret on 7 Apr 2010 14:43 On Wed, 7 Apr 2010 08:15:46 +0200, "Jean" <nosp-jean(a)free.fr> wrote: >Hello > >(pure C and SDK, XP/7) > >I try to read a directory with cyrillic and western mixed file names. >I use FindFirstFileW, WideCharToMultiByte(CP_UFT8... > >when i write the filename to a text file all is correct (with fwrite) >when i add the filename to a listbox i get garbage, idem if i use >MessageBoxA to display the filename To expand a bit on an earlier reply: Functions with names ending in "W" expect Unicode arguments. Functions with names ending in "A" expect ANSII arguments. So you can't use the same string in both. You can use WideCharToMultiByte and MultibyteToWideChar to translate between the two types of string, but then you have two strings (one Unicode and one ANSII). > >any idea ? >Jean > ----------------------------------------- To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message). Robert E. Zaret, eMVP PenFact, Inc. 20 Park Plaza, Suite 400 Boston, MA 02116 www.penfact.com Useful reading (be sure to read its disclaimer first): http://catb.org/~esr/faqs/smart-questions.html
|
Next
|
Last
Pages: 1 2 3 4 Prev: Looking for Open XML SDK tutorial in C++ Next: OS x64 Identification |