FIX: fix plate name encoding issue

Change-Id: Ia89b2c5bbb4519ed938ae23ff124719cfe6203de
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2023-06-20 11:54:31 +08:00 committed by Lane.Wei
parent 869a3046aa
commit 14cb2449c6
11 changed files with 45 additions and 55 deletions

View file

@ -3318,19 +3318,6 @@ void SelectMachineDialog::set_flow_calibration_state(bool state)
}
}
std::string SelectMachineDialog::filter_characters(const std::string& str, const std::string& filterChars)
{
std::string filteredStr = str;
auto removeFunc = [&filterChars](char ch) {
return filterChars.find(ch) != std::string::npos;
};
filteredStr.erase(std::remove_if(filteredStr.begin(), filteredStr.end(), removeFunc), filteredStr.end());
return filteredStr;
}
void SelectMachineDialog::set_default()
{
if (m_print_type == PrintFromType::FROM_NORMAL) {
@ -3365,7 +3352,7 @@ void SelectMachineDialog::set_default()
m_current_project_name = wxString::FromUTF8(filename_path.filename().string());
//unsupported character filter
m_current_project_name = filter_characters(m_current_project_name.ToStdString(), "<>[]:/\\|?*\"");
m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), "<>[]:/\\|?*\""));
m_rename_text->SetLabelText(m_current_project_name);
m_rename_normal_panel->Layout();