From f5807364e84a2c76c9b8222804c05211b0eb6f2a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 18 Oct 2019 15:20:52 +0300 Subject: [PATCH] Force to "backslashreplace" when UnicodeEncodeError arises when writing file // Issue #2796 --- docs | 2 +- platformio/fs.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index e8b93616..8d04b2e1 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit e8b9361615d00180d9cb01af0b401885da091df8 +Subproject commit 8d04b2e1f37808a1a0787942d3a208af389878cc diff --git a/platformio/fs.py b/platformio/fs.py index 23edb634..d75b7837 100644 --- a/platformio/fs.py +++ b/platformio/fs.py @@ -63,7 +63,7 @@ def write_file_contents(path, contents): with open(path, "w") as fp: return fp.write(contents) except UnicodeEncodeError: - with io.open(path, "w", encoding="latin-1") as fp: + with io.open(path, "w", encoding="latin-1", errors="backslashreplace") as fp: return fp.write(contents)