mirror of
https://github.com/edubart/otclient.git
synced 2025-12-14 20:59:47 +01:00
Fix issue #134
This commit is contained in:
@@ -67,9 +67,9 @@ uint64_t hex_to_dec(const std::string& str)
|
||||
return num;
|
||||
}
|
||||
|
||||
std::string utf8_to_latin1(uchar *utf8)
|
||||
std::string utf8_to_latin1(const std::string& src)
|
||||
{
|
||||
auto utf8CharToLatin1 = [](uchar *utf8, int *read) -> char {
|
||||
auto utf8CharToLatin1 = [](const uchar *utf8, int *read) -> char {
|
||||
char c = '?';
|
||||
uchar opt1 = utf8[0];
|
||||
*read = 1;
|
||||
@@ -89,10 +89,10 @@ std::string utf8_to_latin1(uchar *utf8)
|
||||
};
|
||||
|
||||
std::string out;
|
||||
int len = strlen((char*)utf8);
|
||||
int len = src.length();
|
||||
for(int i=0; i<len;) {
|
||||
int read = 0;
|
||||
uchar *utf8char = &utf8[i];
|
||||
uchar *utf8char = (uchar*)&src[i];
|
||||
out += utf8CharToLatin1(utf8char, &read);
|
||||
i += read;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ std::string date_time_string();
|
||||
|
||||
std::string dec_to_hex(uint64_t num);
|
||||
uint64_t hex_to_dec(const std::string& str);
|
||||
std::string utf8_to_latin1(uchar *utf8);
|
||||
std::string utf8_to_latin1(const std::string& src);
|
||||
void tolower(std::string& str);
|
||||
void toupper(std::string& str);
|
||||
void trim(std::string& str);
|
||||
|
||||
Reference in New Issue
Block a user