PIIOTextStream for strings fix

This commit is contained in:
2023-04-07 19:43:56 +03:00
parent 7badc531ce
commit 254649aa10
4 changed files with 6 additions and 5 deletions

View File

@@ -356,15 +356,16 @@ PIString PIString::fromSystem(const char * s) {
}
PIString PIString::fromUTF8(const char * s) {
PIString PIString::fromUTF8(const char * s, int l) {
PIString ret;
if (!s) return ret;
if (s[0] != '\0') {
if ((uchar)s[0] == 0xEF && (uchar)s[1] == 0xBB && (uchar)s[2] == 0xBF) {
s += 3;
if (l > 0) l -= 3;
if (s[0] == '\0') return ret;
}
ret.appendFromChars(s, -1, __utf8name__);
ret.appendFromChars(s, l, __utf8name__);
}
return ret;
}