- unsigned char aChar = theVal->Value(i);
- if (aChar != '\\' || (theVal->Length() - i) < 3) // does not contain the control directive
- {
- continue;
- }
- Standard_Integer aLocalLastCharInd = i - 1;
- Standard_Boolean isConverted = Standard_False;
- // Encoding ISO 8859 characters within a string;
- // ("\P{N}\") control directive;
- // indicates code page for ("\S\") control directive;
- // {N}: "A", "B", "C", "D", "E", "F", "G", "H", "I";
- // "A" identifies ISO 8859-1; "B" identifies ISO 8859-2, etc.
- if (theVal->Value(i + 1) == 'P' && theVal->Length() - i > 3 && theVal->Value(i + 3) == '\\')
- {
- Standard_Character aPageId = UpperCase (theVal->Value(i + 2));
- if (aPageId >= 'A' && aPageId <= 'I')
- {
- aLocalFormatType = (Resource_FormatType)(Resource_FormatType_iso8859_1 + (aPageId - 'A'));
- }
- else
- {
- thecheck->AddWarning("String control directive \\P*\\ with an unsupported symbol in place of *");
- }
-
- isConverted = Standard_True;
- i += 3;
- }
- // Encoding ISO 8859 characters within a string;
- // ("\S\") control directive;
- // converts followed a LATIN CODEPOINT character.
- else if (theVal->Value(i + 1) == 'S' && theVal->Length() - i > 2 && theVal->Value(i + 2) == '\\')
- {
- Standard_Character aResChar = theVal->Value(i + 3) | 0x80;
- const char aStrForCovert[2] = { aResChar, '\0' };
- Resource_Unicode::ConvertFormatToUnicode(aLocalFormatType, aStrForCovert, aTempExtString);
- isConverted = Standard_True;
- i += 3;
- }
- // Encoding U+0000 to U+00FF in a string
- // ("\X\") control directive;
- // converts followed two hexadecimal character.
- else if (theVal->Value(i + 1) == 'X' && theVal->Length() - i > 3 && theVal->Value(i + 2) == '\\')
- {
- Standard_Character aResChar = (char)convertCharacterTo16bit(theVal->Value(i + 3));
- aResChar = (aResChar << 4) | (char)convertCharacterTo16bit(theVal->Value(i + 4));
- const char aStrForCovert[2] = { aResChar, '\0' };
- aTempExtString = TCollection_ExtendedString(aStrForCovert, Standard_False); // pass through without conversion
- isConverted = Standard_True;
- i += 4;
- }
- // Encoding ISO 10646 characters within a string
- // ("\X{N}\") control directive;
- // {N}: "0", "2", "4";
- // "\X2\" or "\X4\" converts followed a hexadecimal character sequence;
- // "\X0\" indicate the end of the "\X2\" or "\X4\".
- else if (theVal->Value(i + 1) == 'X' && theVal->Length() - i > 2 && theVal->Value(i + 3) == '\\')