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

Re: TMerge spoils non-latin chars

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Sun, 11 Jan 2009 08:14:54 +0100

Gerasimov, Ivan wrote:
> Hello, Stefan!
>
>> Strange. I can't reproduce this here. Maybe because your files are in
>> your own codepage (not utf8 or utf16) which I don't have here.
>>
>> But I've tried with test files in my own codepage which have some
>> non-ASCII chars. And I can edit those lines and save/reload without
>> loosing them.
>>
>> Maybe someone which has your codepage can reproduce and fix this?
>
> Just to remind the problem: I have non-English Windows XP installed and
> set English formats in Regional Options. After that, TMerge started to
> spoil non-English text upon saving - it replaced every Russian character
> with a question mark.
>
> I've investigated the problem.
> The bad thing happens in FileTextLines.cpp in these two lines:
>
> CString sLineT = GetAt(i);
> CStringA sLine = CStringA(sLineT);
>
> In the second line of code, MultiByteToWideChar() is called with first
> argument set to CP_THREAD_ACP. And since the thread locale is set to
> something different than the default system locale, conversion goes
> wrong.
>
> There are basically two ways to solve the problem:
> First is to rewrite the code to do the conversion ourselves, and call
> MultiByteToWideChar(CP_ACP, ...).
> And second is to set the thread locale to the same value as the default
> system locale is.
>
> The attached patch does it in the second way.

Committed in r15074.

Stefan

-- 
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=1016761
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].

Received on 2009-01-11 08:15:06 CET

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.