mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 07:34:03 -06:00
Fixed "Slic3r crashes when sending STLs with special characters to the printer"
https://github.com/prusa3d/Slic3r/issues/597 The "Send to OctoPrint" function will now send the file name encoded in UTF-8, so the file name will not get mangled. The C++ Slic3r::encode_path() function was returning a string to Perl, which was marked as UTF-8. This has been fixed, now encode_path() returns a plain Perl string. Added path_to_filename, path_to_stem, path_to_extension, path_to_parent_path Perl wrappers to boost::filesystem::path splitting functionality to be able to split UTF-8 encoded files on Windows correctly.
This commit is contained in:
parent
1bf67b4b62
commit
f5160b7a72
5 changed files with 113 additions and 6 deletions
|
@ -25,16 +25,39 @@ void set_data_dir(const std::string &path);
|
|||
// Return a full path to the GUI resource files.
|
||||
const std::string& data_dir();
|
||||
|
||||
extern std::string encode_path(const char *src);
|
||||
// A special type for strings encoded in the local Windows 8-bit code page.
|
||||
// This type is only needed for Perl bindings to relay to Perl that the string is raw, not UTF-8 encoded.
|
||||
typedef std::string local_encoded_string;
|
||||
|
||||
// Convert an UTF-8 encoded string into local coding.
|
||||
// On Windows, the UTF-8 string is converted to a local 8-bit code page.
|
||||
// On OSX and Linux, this function does no conversion and returns a copy of the source string.
|
||||
extern local_encoded_string encode_path(const char *src);
|
||||
extern std::string decode_path(const char *src);
|
||||
extern std::string normalize_utf8_nfc(const char *src);
|
||||
|
||||
// File path / name / extension splitting utilities, working with UTF-8,
|
||||
// to be published to Perl.
|
||||
namespace PerlUtils {
|
||||
// Get a file name including the extension.
|
||||
extern std::string path_to_filename(const char *src);
|
||||
// Get a file name without the extension.
|
||||
extern std::string path_to_stem(const char *src);
|
||||
// Get just the extension.
|
||||
extern std::string path_to_extension(const char *src);
|
||||
// Get a directory without the trailing slash.
|
||||
extern std::string path_to_parent_path(const char *src);
|
||||
};
|
||||
|
||||
// Timestamp formatted for header_slic3r_generated().
|
||||
extern std::string timestamp_str();
|
||||
// Standard "generated by Slic3r version xxx timestamp xxx" header string,
|
||||
// to be placed at the top of Slic3r generated files.
|
||||
inline std::string header_slic3r_generated() { return std::string("generated by " SLIC3R_FORK_NAME " " SLIC3R_VERSION " " ) + timestamp_str(); }
|
||||
|
||||
// Encode a file into a multi-part HTTP response with a given boundary.
|
||||
std::string octoprint_encode_file_send_request_content(const char *path, bool select, bool print, const char *boundary);
|
||||
|
||||
// Compute the next highest power of 2 of 32-bit v
|
||||
// http://graphics.stanford.edu/~seander/bithacks.html
|
||||
template<typename T>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue