[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [TSVN] Problem with source encoding in TortoiseSVN 1.2

From: SteveKing <steveking_at_gmx.ch>
Date: 2005-06-16 17:13:10 CEST

Norbert Unterberg wrote:
> I have just looked at your fix, and it might not be complete.
> When I added the locale switching in TortoiseProc (see r3391), I used this code:
>
> setlocale(LC_CTYPE, "");
> _setmbcp(_MB_CP_LOCALE);
>
> Using setlocale(LC_ALL, "") can have unexpected side effects, like
> printf/scanf using locale settings for floating point etc. Setting the
> locale for LC_CTYPE switches the locale only for character encodings.
> And the _setmbcp() call sets the locale for the rmultibyte character
> i/o functions.

Well, since we set the locale to the default locale, we should use
LC_ALL here. I was surprised that MFC didn't do that on its own, because
when using the CStdioFile.ReadLine() MFC calls the _fgetss() function -
which didn't work correctly in UNICODE builds because the locale wasn't
even set!

> setlocale(LC_CTYPE) affects the string functions
> _setmbcp() affects file I/O in text mode
> SetThreadLocale() affects the CStringW / CStringA conversion

SetThreadLocale() isn't necessary - it is always set to the default when
an application starts or a new thread is created.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Thu Jun 16 17:13:38 2005

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.