1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

0031940: Foundation Classes - TCollection_ExtendedString::Print() corrupts UNICODE strings and does not compile with C++20

TCollection_ExtendedString::Print() now converts string into UTF-8
instead of printing character indexes.
This commit is contained in:
kgv
2020-11-18 14:56:59 +03:00
committed by bugmaster
parent b84b672185
commit 90e0d12d8f
2 changed files with 13 additions and 10 deletions

View File

@@ -611,16 +611,12 @@ Standard_Integer TCollection_ExtendedString::Length() const
// ----------------------------------------------------------------------------
// Print
// ----------------------------------------------------------------------------
void TCollection_ExtendedString::Print(Standard_OStream& astream) const
{
// ASCII symbols (including extended Ascii) are printed as is;
// other Unicode characters are encoded as SGML numeric character references
for (Standard_Integer i = 0 ; i < mylength ; i++) {
Standard_ExtCharacter c = mystring[i];
if ( IsAnAscii(c) )
astream << ToCharacter(c);
else
astream << "&#" << c << ";";
void TCollection_ExtendedString::Print (Standard_OStream& theStream) const
{
if (mylength > 0)
{
const TCollection_AsciiString aUtf8 (mystring);
theStream << aUtf8;
}
}