osgText::String:createUTF8EncodedString() now supports 4-byte UTF-8 strings (code points over 0x100000).

This commit is contained in:
Daniel Emminizer 2018-12-06 14:07:55 -05:00
parent dc2aa77d98
commit 3a3ddfce49

View File

@ -312,12 +312,19 @@ std::string String::createUTF8EncodedString() const
utf8string+=(char)(0xc0 | (currentChar>>6));
utf8string+=(char)(0x80 | (currentChar & 0x3f));
}
else
else if (currentChar < 0x10000)
{
utf8string+=(char)(0xe0 | (currentChar>>12));
utf8string+=(char)(0x80 | ((currentChar>>6) & 0x3f));
utf8string+=(char)(0x80 | (currentChar & 0x3f));
}
else
{
utf8string+=(char)(0xf0 | (currentChar >> 18));
utf8string+=(char)(0x80 | ((currentChar >> 12) & 0x3f));
utf8string+=(char)(0x80 | ((currentChar >> 6) & 0x3f));
utf8string+=(char)(0x80 | (currentChar & 0x3f));
}
}
return utf8string;
}