[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: Gerasimov, Ivan <Ivan.Gerasimov_at_transas.com>
Date: Sun, 11 Jan 2009 07:49:40 +0300

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

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.

Sincerely yours,
Ivan Gerasimov


To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].

Received on 2009-01-11 05:50:03 CET

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