Skip to content

Commit

Permalink
Merge pull request #56 from Textualize/force-utf8-encoding-for-input-…
Browse files Browse the repository at this point in the history
…file

Hard-code UTF-8 encoding for the input file
  • Loading branch information
willmcgugan authored Jun 21, 2022
2 parents b862e11 + 53cb0e9 commit 0721cb1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Rich-CLI now assumes that the input file is encoded in UTF-8 https://github.com/Textualize/rich-cli/pull/56

## [1.8.0] - 2022-05-07

### Changed
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Rich CLI
# Rich-CLI

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

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.

Expand Down
2 changes: 1 addition & 1 deletion src/rich_cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def read_resource(path: str, lexer: Optional[str]) -> Tuple[str, Optional[str]]:
if path == "-":
return (sys.stdin.read(), None)

with open(path, "rt") as resource_file:
with open(path, "rt", encoding="utf8", errors="replace") as resource_file:
text = resource_file.read()
if not lexer:
_, dot, ext = path.rpartition(".")
Expand Down

0 comments on commit 0721cb1

Please sign in to comment.