mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Cleaned up utf8 decoding code.
It was actually completely broken in newer wxWidgets versions, putting '\0' characters in the string, which broke things like concatenation.
This commit is contained in:
@@ -13,25 +13,6 @@
|
||||
|
||||
// ----------------------------------------------------------------------------- : Unicode
|
||||
|
||||
String decodeUTF8BOM(const String& s) {
|
||||
#ifdef UNICODE
|
||||
if (!s.empty() && s.GetChar(0) == L'\xFEFF') {
|
||||
// skip byte-order-mark
|
||||
return s.substr(1);
|
||||
} else {
|
||||
return s;
|
||||
}
|
||||
#else
|
||||
wxWCharBuffer buf = s.wc_str(wxConvUTF8);
|
||||
if (buf && buf[size_t(0)] == L'\xFEFF') {
|
||||
// skip byte-order-mark
|
||||
return String(buf + 1, *wxConvCurrent);
|
||||
} else {
|
||||
return String(buf, *wxConvCurrent);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void writeUTF8(wxTextOutputStream& stream, const String& str) {
|
||||
#ifdef UNICODE
|
||||
stream.WriteString(str);
|
||||
|
||||
Reference in New Issue
Block a user