[windev] INI files and Russian

Serge Wautier serge at wautier.net
Mon Apr 20 05:54:48 GMT 2009


GetPrivateProfileStringA() uses the system code page to read the contents.
Which means it would work on Russian computers even though it doesn't on
yours.

HTH,

Serge.
http://www.apptranslator.com



> -----Original Message-----
> From: windev-bounces at windev.org [mailto:windev-bounces at windev.org] On
> Behalf Of truckleaj-windev at yahoo.co.uk
> Sent: dimanche 19 avril 2009 20:48
> To: truckleaj-windev at yahoo.co.uk; windev at windev.org
> Subject: Re: [windev] INI files and Russian
> 
> I am not getting very far with this:
> {charszBuffer[_MAX_PATH];GetPrivateProfileStringA("labels",
> "lblhighlights", "", szBuffer, _MAX_PATH, "c:\\test.ini");intlenA=
> lstrlenA(szBuffer);intlenW;WCHAR*unicodestr;lenW=
> ::MultiByteToWideChar(1251, 0, szBuffer, lenA, 0, 0);if(lenW>
> 0)unicodestr= newWCHAR[lenW];// Check whether conversion was
> successful::
> }MultiByteToWideChar(CP_ACP, 0, szBuffer, lenA, unicodestr,
> lenW);else{// handle the error}
> 
> I don't understand it.
> 
> Why can't I take a INI file that I know is ANSI and contains Russian
> script and extract data from it into a CString in a unicode app?
> 
> At the moment the only way I get things working is by running my app
> inside MS AppLocale with Russian codepage.  I have tried using 1251 as
> the codepage and ity makes no difference.
> 
> I have googled for two days now and not come up with solution.
> 
> Andrew
> 
> 
> 
> 
> ________________________________
> From: "truckleaj-windev at yahoo.co.uk" <truckleaj-windev at yahoo.co.uk>
> To: windev at windev.org
> Sent: Friday, 17 April, 2009 22:28:31
> Subject: [windev] INI files and Russian
> 
> Hello
> 
> I try keep this brief and to the point.
> 
> My application is Unicode and is running in Russian.
> 
> It executes a 3rd party application which is not unicode and waits for
> it to create a INI file.
> 
> This INI file is not unicode, but contains russian content.
> 
> The only way I can view the russian content as cryllic is by running
> notepad inside ms applocale (set to russian) and then opening the INI
> file.
> 
> My problem is that my program is unicode. When I do
> GetPrivateProfileString with this ANSI text file, it is not providing
> me Russian cryllic content.
> 
> If I take the file that was opened in notepad (via ms applocale) and
> save as unicode, and use that in my program, I get good cryllic output.
> 
> I can't change how the INI file is created as it is done by the 3rd
> party app. So is there a way that I can still use
> GetprivateProfileString with this ansi file inside my unicode app and
> end up with the unicode russian text?
> 
> I hope I am making sense.
> 
> Andrew
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.windev.org/pipermail/windev/attachments/20090417/1c5e06e5/
> attachment.htm
> --
> Windev mailing list at Windev at windev.org
> 
> Lost your password?  Need to unsubscribe or change your delivery
> options?
> Go to http://lists.windev.org/mailman/listinfo/windev
> --
> Search the Windev Archives - www.windev.org
> delete[] unicodestr;
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.windev.org/pipermail/windev/attachments/20090419/749aa5ea/
> attachment.htm
> --
> Windev mailing list at Windev at windev.org
> 
> Lost your password?  Need to unsubscribe or change your delivery
> options?
> Go to http://lists.windev.org/mailman/listinfo/windev
> --
> Search the Windev Archives - www.windev.org



More information about the Windev mailing list