From 902385992228dea2e1a0f41a10026bc398244eae Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sat, 26 Oct 2024 19:21:34 +0100 Subject: [PATCH] fix encoding --- CHANGELOG.md | 7 +++++++ pyproject.toml | 2 +- src/textual/driver.py | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfc875954f..f1e144e36e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.85.1] - 2024-10-26 + +### Fixed + +- Fixed encoding issue when saving files such as screenshots on Windows + ## [0.85.0] - 2024-10-25 ### Changed @@ -2483,6 +2489,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040 - New handler system for messages that doesn't require inheritance - Improved traceback handling +[0.85.1]: https://github.com/Textualize/textual/compare/v0.85.0...v0.85.1 [0.85.0]: https://github.com/Textualize/textual/compare/v0.84.0...v0.85.0 [0.84.0]: https://github.com/Textualize/textual/compare/v0.83.0...v0.84.0 [0.83.0]: https://github.com/Textualize/textual/compare/v0.82.0...v0.83.0 diff --git a/pyproject.toml b/pyproject.toml index c8109c3c60..bfedac914f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "textual" -version = "0.85.0" +version = "0.85.1" homepage = "https://github.com/Textualize/textual" repository = "https://github.com/Textualize/textual" documentation = "https://textual.textualize.io/" diff --git a/src/textual/driver.py b/src/textual/driver.py index 3a48f7d59d..43880153fc 100644 --- a/src/textual/driver.py +++ b/src/textual/driver.py @@ -240,7 +240,9 @@ def deliver_binary( def save_file_thread(binary: BinaryIO | TextIO, mode: str) -> None: try: - with open(save_path, mode) as destination_file: + with open( + save_path, mode, encoding=encoding or "utf-8" + ) as destination_file: read = binary.read write = destination_file.write chunk_size = 1024 * 64