]> OCCT Git - occt-copy.git/commitdiff
0031878: DXF import - support Windows and ISO 8859 code pages in DXF import
authordpasukhi <dpasukhi@opencascade.com>
Wed, 28 Oct 2020 12:13:56 +0000 (15:13 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 29 Oct 2020 16:01:54 +0000 (19:01 +0300)
Add support of converting Big5 and GBK code pages to Unicode within Resource_Unicode::ConvertFormatToUnicode

src/Resource/Resource_FormatType.hxx
src/Resource/Resource_Unicode.cxx

index 66f4ccc679817b6658c01860b8e580c40dba071d..62e0c06e0494e4faea53903d900c0be882bc66f9 100644 (file)
@@ -51,6 +51,10 @@ enum Resource_FormatType
   Resource_FormatType_iso8859_8,    //!< ISO 8859-8 (Hebrew) encoding
   Resource_FormatType_iso8859_9,    //!< ISO 8859-9 (Turkish) encoding
 
+  // Addition code pages
+  Resource_FormatType_GBK,          //!< GBK  (UnifiedChinese) encoding
+  Resource_FormatType_Big5,         //!< Big5 (TradChinese) encoding
+
   // old aliases
   Resource_FormatType_ANSI = Resource_FormatType_NoConversion,
   Resource_SJIS = Resource_FormatType_SJIS,
index ab24ce22ee2ec48a4e2532dd5685defea12cb2b2..03761b8c1009b3bbb66c7a5e35f52d93b7dabb48 100644 (file)
@@ -652,6 +652,16 @@ void Resource_Unicode::ConvertFormatToUnicode (const Resource_FormatType theForm
       }
       break;
     }
+    case Resource_FormatType_Big5:
+    {
+      ConvertBig5ToUnicode(theFromStr, theToStr);
+      break;
+    }
+    case Resource_FormatType_GBK:
+    {
+      ConvertGBKToUnicode(theFromStr, theToStr);
+      break;
+    }
     case Resource_FormatType_UTF8:
     {
       theToStr = TCollection_ExtendedString (theFromStr, Standard_True);
@@ -760,6 +770,11 @@ Standard_Boolean Resource_Unicode::ConvertUnicodeToFormat(const Resource_FormatT
       const NCollection_Utf16String aString (theFromStr.ToExtString());
       return aString.ToLocale (theToStr, theMaxSize);
     }
+    case Resource_FormatType_GBK:
+    case Resource_FormatType_Big5:
+    {
+      throw Standard_NotImplemented("Resource_Unicode::ConvertUnicodeToFormat - convert from GBK and Big5 to Unocode is not implemented");
+    }
   }
   return Standard_False;
 }