1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Unicode conversion functions now require source encoding

This commit is contained in:
Ivan Savenko
2023-02-24 16:15:45 +02:00
parent 8b3309b47d
commit bd70b6fabd
14 changed files with 319 additions and 313 deletions

View File

@@ -86,7 +86,7 @@ INSTANTIATE(si64, readInt64)
#undef INSTANTIATE
std::string CBinaryReader::readString()
std::string CBinaryReader::readBaseString()
{
unsigned int len = readUInt32();
assert(len <= 500000); //not too long
@@ -95,10 +95,7 @@ std::string CBinaryReader::readString()
std::string ret;
ret.resize(len);
read(reinterpret_cast<ui8*>(&ret[0]), len);
//FIXME: any need to move this into separate "read localized string" method?
if (TextOperations::isValidASCII(ret))
return ret;
return TextOperations::toUnicode(ret);
return ret;
}
return "";