Skip to content

Commit

Permalink
fix: utf8 everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
vberlier committed Feb 20, 2024
1 parent 8cfb5d4 commit 3897b0d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion beet/contrib/livereload.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def decorator(callback: LogCallback):
def target(self, path: FileSystemPath, callback: LogCallback):
queue: List[str] = []

with open(path, "r", errors="ignore") as f:
with open(path, "r", encoding="utf-8", errors="ignore") as f:
f.seek(0, 2)

while not self.event.is_set():
Expand Down
2 changes: 1 addition & 1 deletion beet/core/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(
self.directory = Path(directory).resolve()
self.index_path = self.directory / self.index_file
self.index = (
json.loads(self.index_path.read_text())
json.loads(self.index_path.read_text("utf-8"))
if self.index_path.is_file()
else self.get_initial_index()
)
Expand Down
2 changes: 1 addition & 1 deletion beet/core/watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __post_init__(self):
if ignore_file.is_file():
self.ignore_patterns += [
pattern
for line in ignore_file.read_text().splitlines()
for line in ignore_file.read_text("utf-8").splitlines()
if not line.startswith("#") and (pattern := line.strip())
]

Expand Down
6 changes: 3 additions & 3 deletions beet/toolchain/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,11 @@ def load_config(
if not path:
config: Any = {}
elif path.suffix == ".toml":
config = toml.loads(path.read_text())
config = toml.loads(path.read_text("utf-8"))
elif path.suffix in [".yml", ".yaml"]:
config = yaml.safe_load(path.read_text())
config = yaml.safe_load(path.read_text("utf-8"))
else:
config = json.loads(path.read_text())
config = json.loads(path.read_text("utf-8"))

if not config:
config = {}
Expand Down

0 comments on commit 3897b0d

Please sign in to comment.