diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-07-05 15:18:29 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-07-07 11:07:18 +0300 |
commit | 0c5431644d103728aa926896d9bbdf40ed8d5cc3 (patch) | |
tree | 8f26e1af2ef948101163bb9fc9546be40bb4bc3c /drivers/unix/os_unix.cpp | |
parent | 28a3dee276d64d7c2bf1c7d54ebbb5a6b82caf4a (diff) | |
download | redot-engine-0c5431644d103728aa926896d9bbdf40ed8d5cc3.tar.gz |
Allows parsing of invalid UTF-16 surrogates (can be encountered in Windows filenames) and some non-standard UTF-8 variants, makes Unicode parse errors more verbose.
Diffstat (limited to 'drivers/unix/os_unix.cpp')
-rw-r--r-- | drivers/unix/os_unix.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 52a4d538e1..091287c652 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -313,7 +313,12 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, St if (p_pipe_mutex) { p_pipe_mutex->lock(); } - (*r_pipe) += String::utf8(buf); + String pipe_out; + if (pipe_out.parse_utf8(buf) == OK) { + (*r_pipe) += pipe_out; + } else { + (*r_pipe) += String(buf); // If not valid UTF-8 try decode as Latin-1 + } if (p_pipe_mutex) { p_pipe_mutex->unlock(); } |