Sign in to follow this  
Followers 0
Sergeo7

Bug with characters in my compilation

5 posts in this topic

The ApexDC++ 1.0.0 Beta4 compilation is going well (I am using STLPort 5.2 and WTL 8 fixed used on VS2005 SP1), but after I run it and type text there is a bug when it is showing in chat window: instead of some cyrillic characters it is showing some other irrelevant chars.

Can anyone help to solve this problem?

Share this post


Link to post
Share on other sites

In my opinion you just need to add some code pages from Control Panel>Regional Settings.

Share this post


Link to post
Share on other sites

Eh.. no one wish to answer so I had to find the bug by myself:

Function disableCzChars really don't care about current locale so if it is not czech it'll "randomly" destroy non-english chars.

And somehow the option to use it was enabled when I run new build with old settings.

Share this post


Link to post
Share on other sites

Maybe you have installed some third-party cyrillization software. Flextype does awful things here in BG.

Share this post


Link to post
Share on other sites

No, there is no such thing. All just as I said earlier.

I think something like this could resolve problem (just disabling removal of diacritic marks in options is really lame solution):

text.h

	extern const string utf8;

	extern string systemCharset;

	extern bool isCzechLocale;
text.cpp
const string utf8 = "utf-8"; // optimization

string systemCharset;

bool isCzechLocale = false;


void initialize() {

	setlocale(LC_ALL, "");


#ifdef _WIN32

	char *ctype = setlocale(LC_CTYPE, NULL);

	if(ctype) {

		systemCharset = string(ctype);

	} else {

		dcdebug("Unable to determine the program's locale");

	}

#else

	systemCharset = string(nl_langinfo(CODESET));

#endif

	if(systemCharset.find("Czech") != string::npos) //todo: all other locales with diacritic

		isCzechLocale = true;

}
and WinUtil.cpp
const tstring& WinUtil::disableCzChars(tstring& message) {

	if (!Text::isCzechLocale)

		return message;

	for(size_t j = 0; j < message.length(); j++) {

		for(size_t l = 0; l < (sizeof(arrayutf) / sizeof(arrayutf[0])); l++) {

			if (message[j] == arrayutf[l]) {

				message[j] = arraywin[l];

				break;

			}

		}

	}

	return message;

}

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0