Jump to content

Quest Fix Letters Delay Encoding UTF8


Recommended Posts

Well, come on, how can I start explaining why this topic.

I am Brazilian and all the files that my text files are in UTF8, so I started checking the source of metin2 in search of leaving all files with UTF8 encoding and not having visual bugs. My source, server, client, etc ... is already totally in UTF8 without BOM.

In this topic I will leave the FIX of a visual bug that I had in my quests when I add delay. Technically the problem is that UTF8 is multibyte, so the function that separated letter by letter always took a fixed value from the string encoded in utf8 ... thus giving shit.

vIYxNWZ.gifvSrgcUH.gif

In EterLib/parser.cpp

Spoiler

Above function add:
 



LPSTR CharMoveNext(LPSTR szString)
{
	if (szString == 0 || *szString == 0)
		return 0;

	if ((szString[0] & 0x80) == 0x00)
		return szString + 1;
	else if ((szString[0] & 0xE0) == 0xC0)
		return szString + 2;
	else if ((szString[0] & 0xF0) == 0xE0)
		return szString + 3;
	else if ((szString[0] & 0xF8) == 0xF0)
		return szString + 4;
	else
		return szString + 1;
}


And change this line:


const char *word_next = CharNextExA(codePage, word, 0);

to:



const char *word_next = CharMoveNext((LPSTR)word);

 

Technically the problem was solved.
I am not very good with c ++, I found this solution in forums on the internet. If someone has a better solution just leave the feedback.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Good 1
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.