Skip to content

Commit 37e447a

Browse files
AA-Turnermiss-islington
authored andcommitted
pythonGH-137841: Open tzdata/zones file with UTF-8 encoding (pythonGH-137872)
(cherry picked from commit 25b9728) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
1 parent cbeada9 commit 37e447a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/zoneinfo/_tzpath.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ def available_timezones():
131131
# Start with loading from the tzdata package if it exists: this has a
132132
# pre-assembled list of zones that only requires opening one file.
133133
try:
134-
with resources.files("tzdata").joinpath("zones").open("r") as f:
134+
zones_file = resources.files("tzdata").joinpath("zones")
135+
with zones_file.open("r", encoding="utf-8") as f:
135136
for zone in f:
136137
zone = zone.strip()
137138
if zone:

0 commit comments

Comments
 (0)