Skip to content

Commit 1253a8b

Browse files
[3.14] GH-137841: Open tzdata/zones file with UTF-8 encoding (GH-137872) (#141607)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
1 parent f1bed5b commit 1253a8b

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)