1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0031923: DXF import - add support of code page DOS850

- Add support for converting from CP850 to UTF-8 and UTF-8 to CP850;
- Add support for reading STEP file encoding by cp850 code page.
This commit is contained in:
dpasukhi
2020-11-23 15:04:06 +03:00
committed by bugmaster
parent 1e08a76f1e
commit c026141bb6
5 changed files with 102 additions and 2 deletions

View File

@@ -14,7 +14,7 @@
#include <Standard_TypeDef.hxx>
// Code pages ANSI -> UTF16
static const Standard_ExtCharacter THE_CODEPAGES_ANSI[Resource_FormatType_iso8859_9 - Resource_FormatType_CP1250 + 1][128] =
static const Standard_ExtCharacter THE_CODEPAGES_ANSI[Resource_FormatType_CP850 - Resource_FormatType_CP1250 + 1][128] =
{
{
// code page: cp1250
@@ -662,5 +662,41 @@ static const Standard_ExtCharacter THE_CODEPAGES_ANSI[Resource_FormatType_iso885
0xf4, 0xf5, 0xf6, 0xf7,
0xf8, 0xf9, 0xfa, 0xfb,
0xfc, 0x131, 0x15f, 0xff
},
{
// code page: cp850
0xc7, 0xfc, 0xe9, 0xe2,
0xe4, 0xe0, 0xe5, 0xe7,
0xea, 0xeb, 0xe8, 0xef,
0xee, 0xec, 0xc4, 0xc5,
0xc9, 0xe6, 0xc6, 0xf4,
0xf6, 0xf2, 0xfb, 0xf9,
0xff, 0xd6, 0xdc, 0xf8,
0xa3, 0xd8, 0xd7, 0x192,
0xe1, 0xed, 0xf3, 0xfa,
0xf1, 0xd1, 0xaa, 0xba,
0xbf, 0xae, 0xac, 0xbd,
0xbc, 0xa1, 0xab, 0xbb,
0x2591, 0x2592, 0x2593, 0x2502,
0x2524, 0xc1, 0xc2, 0xc0,
0xa9, 0x2563, 0x2551, 0x2557,
0x255d, 0xa2, 0xa5, 0x2510,
0x2514, 0x2534, 0x252c, 0x251c,
0x2500, 0x253c, 0xe3, 0xc3,
0x255a, 0x2554, 0x2569, 0x2566,
0x2560, 0x2550, 0x256c, 0xa4,
0xf0, 0xd0, 0xca, 0xcb,
0xc8, 0x131, 0xcd, 0xce,
0xcf, 0x2518, 0x250c, 0x2588,
0x2584, 0xa6, 0xcc, 0x2580,
0xd3, 0xdf, 0xd4, 0xd2,
0xf5, 0xd5, 0xb5, 0xfe,
0xde, 0xda, 0xdb, 0xd9,
0xfd, 0xdd, 0xaf, 0xb4,
0xad, 0xb1, 0x2017, 0xbe,
0xb6, 0xa7, 0xf7, 0xb8,
0xb0, 0xa8, 0xb7, 0xb9,
0xb3, 0xb2, 0x25a0, 0xa0
}
};

View File

@@ -52,6 +52,7 @@ enum Resource_FormatType
Resource_FormatType_iso8859_9, //!< ISO 8859-9 (Turkish) encoding
// Addition code pages
Resource_FormatType_CP850, //!< ISO 850 (Western European) encoding
Resource_FormatType_GBK, //!< GBK (UnifiedChinese) encoding
Resource_FormatType_Big5, //!< Big5 (TradChinese) encoding

View File

@@ -634,6 +634,7 @@ void Resource_Unicode::ConvertFormatToUnicode (const Resource_FormatType theForm
case Resource_FormatType_iso8859_7:
case Resource_FormatType_iso8859_8:
case Resource_FormatType_iso8859_9:
case Resource_FormatType_CP850:
{
const int aCodePageIndex = (int)theFormat - (int)Resource_FormatType_CP1250;
const Standard_ExtString aCodePage = THE_CODEPAGES_ANSI[aCodePageIndex];
@@ -718,6 +719,7 @@ Standard_Boolean Resource_Unicode::ConvertUnicodeToFormat(const Resource_FormatT
case Resource_FormatType_iso8859_7:
case Resource_FormatType_iso8859_8:
case Resource_FormatType_iso8859_9:
case Resource_FormatType_CP850:
{
if (theMaxSize < theFromStr.Length())
{