PIIOTextStream for strings fix
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1700,7 +1700,7 @@ public:
|
||||
|
||||
//! \~english Returns string constructed from UTF-8.
|
||||
//! \~russian Возвращает строку созданную из UTF-8.
|
||||
static PIString fromUTF8(const char * s);
|
||||
static PIString fromUTF8(const char * s, int l = -1);
|
||||
|
||||
//! \~english Returns string constructed from UTF-8.
|
||||
//! \~russian Возвращает строку созданную из UTF-8.
|
||||
|
||||
Reference in New Issue
Block a user