Skip to content

Commit

Permalink
Use 'utf-8' throughout for consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Apr 28, 2024
1 parent e1caa2c commit 2b9e1cf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/towncrier/_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def find_fragments(
full_filename = os.path.join(section_dir, basename)
fragment_filenames.append(full_filename)
with open(full_filename, "rb") as f:
data = f.read().decode("utf8", "replace")
data = f.read().decode("utf-8", "replace")

if (ticket, category, counter) in file_content:
raise ValueError(
Expand Down
4 changes: 2 additions & 2 deletions src/towncrier/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def append_to_newsfile(
# Leave newlines alone. This probably leads to inconsistent newlines,
# because we've loaded existing content with universal newlines, but that's
# the original behavior.
with news_file.open("w", encoding="utf8", newline="") as f:
with news_file.open("w", encoding="utf-8", newline="") as f:
if header:
f.write(header)
# If there is no previous body that means we're writing a brand new news file.
Expand All @@ -66,7 +66,7 @@ def _figure_out_existing_content(

# If we didn't use universal newlines here, we wouldn't find *start_string*
# which usually contains a `\n`.
with news_file.open(encoding="utf8") as f:
with news_file.open(encoding="utf-8") as f:
content = f.read()

t = content.split(start_string, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/towncrier/test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def read_pkg_resource(path: str) -> str:
"""
Read *path* from the towncrier package.
"""
return (resources.files("towncrier") / path).read_text("utf8")
return (resources.files("towncrier") / path).read_text("utf-8")


def with_isolated_runner(fn: Callable[..., Any]) -> Callable[..., Any]:
Expand Down

0 comments on commit 2b9e1cf

Please sign in to comment.