Skip to content

Commit 25b9728

Browse files
authored
GH-137841: Open tzdata/zones file with UTF-8 encoding (#137872)
1 parent 7636a66 commit 25b9728

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
@@ -124,7 +124,8 @@ def available_timezones():
124124
# Start with loading from the tzdata package if it exists: this has a
125125
# pre-assembled list of zones that only requires opening one file.
126126
try:
127-
with resources.files("tzdata").joinpath("zones").open("r") as f:
127+
zones_file = resources.files("tzdata").joinpath("zones")
128+
with zones_file.open("r", encoding="utf-8") as f:
128129
for zone in f:
129130
zone = zone.strip()
130131
if zone:

0 commit comments

Comments
 (0)