osgText::String:createUTF8EncodedString() now supports 4-byte UTF-8 strings (code points over 0x100000).
This commit is contained in:
parent
dc2aa77d98
commit
3a3ddfce49
@ -312,12 +312,19 @@ std::string String::createUTF8EncodedString() const
|
|||||||
utf8string+=(char)(0xc0 | (currentChar>>6));
|
utf8string+=(char)(0xc0 | (currentChar>>6));
|
||||||
utf8string+=(char)(0x80 | (currentChar & 0x3f));
|
utf8string+=(char)(0x80 | (currentChar & 0x3f));
|
||||||
}
|
}
|
||||||
else
|
else if (currentChar < 0x10000)
|
||||||
{
|
{
|
||||||
utf8string+=(char)(0xe0 | (currentChar>>12));
|
utf8string+=(char)(0xe0 | (currentChar>>12));
|
||||||
utf8string+=(char)(0x80 | ((currentChar>>6) & 0x3f));
|
utf8string+=(char)(0x80 | ((currentChar>>6) & 0x3f));
|
||||||
utf8string+=(char)(0x80 | (currentChar & 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;
|
return utf8string;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user