自动代码页检测
Contents
[
Hide
]自动代码页检测
Aspose.CAD 支持对 DWG 和 DWF 文件进行自动代码页检测。如果您不希望使用此功能,可以通过设置 LoadOptions 类的以下属性来覆盖此设置。
- SpecifiedEncoding: 设置用于从非 Unicode DXF 和 DWG 格式读取文本数据的编码。默认情况下,它是自动检测的。
- SpecifiedMifEncoding: 设置用于读取 CJK 编码的 MIF 编码符号(M+nXXXX 格式)的编码。默认情况下,它是自动检测的。
- RecoverMalformedCifMif: 定义如果 CIF (U+XXXX) 和 MIF 编码字符没有正确的 AutoCAD 格式(AutoCAD 用反斜杠前置这些符号),是否会被解码。默认情况下,它们会被解码。
示例代码
下面的代码示例显示了如何在 Aspose.CAD 中覆盖自动代码页检测。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cad/Aspose.CAD-for-.NET | |
string SourceDir = RunExamples.GetDataDir_DWGDrawings(); | |
using (CadImage cadImage = (CadImage)Image.Load(SourceDir + "SimpleEntites.dwg", | |
new LoadOptions() | |
{ | |
SpecifiedEncoding = CodePages.Japanese, | |
SpecifiedMifEncoding = MifCodePages.Japanese, | |
RecoverMalformedCifMif = false | |
})) | |
{ | |
//do export or something else with cadImage | |
} |