Skip to content

Commit 0721cb1

Browse files
authored
Merge pull request #56 from Textualize/force-utf8-encoding-for-input-file
Hard-code UTF-8 encoding for the input file
2 parents b862e11 + 53cb0e9 commit 0721cb1

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Changed
11+
12+
- Rich-CLI now assumes that the input file is encoded in UTF-8 https://github.com/Textualize/rich-cli/pull/56
13+
814
## [1.8.0] - 2022-05-07
915

1016
### Changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Rich CLI
1+
# Rich-CLI
22

3-
Rich-cli is a command line toolbox for fancy output in the terminal, built with [Rich](https://github.com/Textualize/rich).
3+
Rich-CLI is a command line toolbox for fancy output in the terminal, built with [Rich](https://github.com/Textualize/rich).
44

55
Use the `rich` command to highlight a variety of file types in the terminal, with specialized rendering for Markdown and JSON files. Additionally you can markup and format text from the command line.
66

src/rich_cli/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def read_resource(path: str, lexer: Optional[str]) -> Tuple[str, Optional[str]]:
102102
if path == "-":
103103
return (sys.stdin.read(), None)
104104

105-
with open(path, "rt") as resource_file:
105+
with open(path, "rt", encoding="utf8", errors="replace") as resource_file:
106106
text = resource_file.read()
107107
if not lexer:
108108
_, dot, ext = path.rpartition(".")

0 commit comments

Comments
 (0)