Work around bad null decoding (overlong) in Jak & Daxter savedata title.

This commit is contained in:
Henrik Rydgård committed 2025-04-09 11:59:17 +02:00
1 parent 50410d0de3
commit abff8a078f
2 files changed
+10

No files matched your search

+7
View File
@@ -161,6 +161,13 @@ std::string SanitizeString(std::string_view input, StringRestriction restriction
}
}
if (restriction == StringRestriction::NoLineBreaksOrSpecials) {
// Additionally, cut off the string if we find an overlong UTF-8 character, such as in Jak & Daxter's title.
size_t pos = sanitized.find("\xc0\x80");
if (pos != (size_t)std::string::npos) {
sanitized.resize(pos);
}
}
return sanitized;
}