Skip to content

Commit

Permalink
Fix: use utf-8 encoding in open calls, fixes #4676
Browse files Browse the repository at this point in the history
  • Loading branch information
georgesittas committed Jan 29, 2025
1 parent cd53f7e commit 0920f77
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def sqlglotrs_version():
with open("sqlglotrs/Cargo.toml") as fd:
with open("sqlglotrs/Cargo.toml", encoding="utf-8") as fd:
for line in fd.readlines():
if line.strip().startswith("version"):
return line.split("=")[1].strip().strip('"')
Expand Down
4 changes: 2 additions & 2 deletions tests/gen_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,10 @@


def rewrite_fixtures(in_path, out_path, schema, num, kind):
with open(out_path, "w", encoding="UTF-8") as fixture:
with open(out_path, "w", encoding="utf-8") as fixture:
for i in range(num):
i = i + 1
with open(in_path.format(i=i), encoding="UTF-8") as file:
with open(in_path.format(i=i), encoding="utf-8") as file:
original = "\n".join(
line.rstrip()
for line in file.read().split(";")[0].split("\n")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_jsonpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_identity(self):
self.assertEqual(parse(selector).sql(), f"'{expected}'")

def test_cts_file(self):
with open(os.path.join(FIXTURES_DIR, "jsonpath", "cts.json")) as file:
with open(os.path.join(FIXTURES_DIR, "jsonpath", "cts.json"), encoding="utf-8") as file:
tests = json.load(file)["tests"]

# sqlglot json path generator rewrites to a normal form
Expand Down

0 comments on commit 0920f77

Please sign in to comment.