Skip to content

Commit

Permalink
Update iterators.pxi
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgen-lentz authored Dec 1, 2024
1 parent 94fb545 commit a39ff75
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions amplpy/iterators.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ cdef class EnvIterator(object):
import sys
if sys.platform == "win32":
try:
name = name_c.decode('utf-16')
value = value_c.decode('utf-16')
name = name_c.decode('utf-16', errors='replace')
value = value_c.decode('utf-16', errors='replace')
except UnicodeDecodeError as e:
raise RuntimeError(f"Failed to decode environment variable (Windows): {e}")
else:
try:
name = name_c.decode('utf-8') # Strict UTF-8 decoding
value = value_c.decode('utf-8')
name = name_c.decode('utf-8', errors='replace')
value = value_c.decode('utf-8', errors='replace')
except UnicodeDecodeError as e:
raise RuntimeError(f"Failed to decode environment variable (Non-Windows): {e}")

Expand Down

0 comments on commit a39ff75

Please sign in to comment.