From 0534afd6aaa14513e1e0a7f417b5af4de64e78da Mon Sep 17 00:00:00 2001 From: Filip Sykala - NTB T15p Date: Wed, 21 Aug 2024 15:55:02 +0200 Subject: [PATCH] Use not utf8 std::string for open output stream (SPE-2442) --- src/slic3r/GUI/Gizmos/GLGizmoSVG.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSVG.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSVG.cpp index 34b13e6473..8e27d4d1f7 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSVG.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSVG.cpp @@ -1595,20 +1595,21 @@ void GLGizmoSVG::draw_filename(){ if (dlg.ShowModal() == wxID_OK ){ last_used_directory = dlg.GetDirectory(); wxString out_path = dlg.GetPath(); - std::string path{out_path.ToUTF8().data()}; - //Slic3r::save(*m_volume_shape.svg_file.image, path); - - std::ofstream stream(path); + //Slic3r::save(*m_volume_shape.svg_file.image, out_path.ToUTF8().data()); + + // Be carefull out_path_str is not UTF8 on purpose - storing into not ut6 filepath + std::string out_path_str(out_path.c_str()); + std::ofstream stream(out_path_str); if (stream.is_open()){ stream << *svg.file_data; // change source file m_filename_preview.clear(); - m_volume_shape.svg_file->path = path; + m_volume_shape.svg_file->path = out_path.ToUTF8().data(); m_volume_shape.svg_file->path_in_3mf.clear(); // possible change name m_volume->emboss_shape->svg_file = m_volume_shape.svg_file; // copy - write changes into volume } else { - BOOST_LOG_TRIVIAL(error) << "Opening file: \"" << path << "\" Failed"; + BOOST_LOG_TRIVIAL(error) << "Opening file: \"" << out_path_str << "\" Failed"; } }