From e1477e642cd92052410b5e54a8ab9f8fd79ce35d Mon Sep 17 00:00:00 2001 From: Mack Date: Tue, 29 Oct 2024 16:17:08 +0800 Subject: [PATCH] FIX:Replace non-UTF8 characters in STEP model names with IDs on import jira: STUDIO-8055 Change-Id: I9255a7a871ebc9920ec683d1a2a80cd53ada0f10 (cherry picked from commit 89be3166e286346254a08c8efc188e0cea83f2a4) --- src/libslic3r/Format/STEP.cpp | 2 +- src/libslic3r/Format/STEP.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Format/STEP.cpp b/src/libslic3r/Format/STEP.cpp index 283fe63798..a637cdd3ca 100644 --- a/src/libslic3r/Format/STEP.cpp +++ b/src/libslic3r/Format/STEP.cpp @@ -182,7 +182,7 @@ static void getNamedSolids(const TopLoc_Location& location, const std::string& p if (referredLabel.FindAttribute(TDataStd_Name::GetID(), shapeName)) name = TCollection_AsciiString(shapeName->Get()).ToCString(); - if (name == "") + if (name == "" || !StepPreProcessor::isUtf8(name)) name = std::to_string(id++); std::string fullName{name}; diff --git a/src/libslic3r/Format/STEP.hpp b/src/libslic3r/Format/STEP.hpp index 72f8327106..64e52aa9be 100644 --- a/src/libslic3r/Format/STEP.hpp +++ b/src/libslic3r/Format/STEP.hpp @@ -42,8 +42,8 @@ class StepPreProcessor { public: bool preprocess(const char* path, std::string &output_path); static bool isUtf8File(const char* path); -private: static bool isUtf8(const std::string str); +private: static bool isGBK(const std::string str); static int preNum(const unsigned char byte); //BBS: default is UTF8 for most step file.