mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-21 07:23:13 +08:00
FIX:Replace non-UTF8 characters in STEP model names with IDs on import
jira: STUDIO-8055 Change-Id: I9255a7a871ebc9920ec683d1a2a80cd53ada0f10
This commit is contained in:
parent
1e3d16c2f1
commit
89be3166e2
@ -177,7 +177,7 @@ static void getNamedSolids(const TopLoc_Location& location, const std::string& p
|
|||||||
if (referredLabel.FindAttribute(TDataStd_Name::GetID(), shapeName))
|
if (referredLabel.FindAttribute(TDataStd_Name::GetID(), shapeName))
|
||||||
name = TCollection_AsciiString(shapeName->Get()).ToCString();
|
name = TCollection_AsciiString(shapeName->Get()).ToCString();
|
||||||
|
|
||||||
if (name == "")
|
if (name == "" || !StepPreProcessor::isUtf8(name))
|
||||||
name = std::to_string(id++);
|
name = std::to_string(id++);
|
||||||
std::string fullName{name};
|
std::string fullName{name};
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@ class StepPreProcessor {
|
|||||||
public:
|
public:
|
||||||
bool preprocess(const char* path, std::string &output_path);
|
bool preprocess(const char* path, std::string &output_path);
|
||||||
static bool isUtf8File(const char* path);
|
static bool isUtf8File(const char* path);
|
||||||
private:
|
|
||||||
static bool isUtf8(const std::string str);
|
static bool isUtf8(const std::string str);
|
||||||
|
private:
|
||||||
static bool isGBK(const std::string str);
|
static bool isGBK(const std::string str);
|
||||||
static int preNum(const unsigned char byte);
|
static int preNum(const unsigned char byte);
|
||||||
//BBS: default is UTF8 for most step file.
|
//BBS: default is UTF8 for most step file.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user