poml icon indicating copy to clipboard operation
poml copied to clipboard

[Bug] UnicodeDecodeError when reading poml file on Windows Chinese environment

Open EcoleKeine opened this issue 2 months ago • 2 comments

UnicodeDecodeError when reading poml file on Windows Chinese environment

Description

When using poml to read a .poml file (utf-8) on Windows with Chinese locale, a UnicodeDecodeError occurs because the system tries to decode the file with GBK codec instead of UTF-8.

Error

UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 61: illegal multibyte sequence

Environment

  • poml 0.0.8
  • Windows Chinese environment
  • Python 3.13.2
  • utf-8 python & poml file

Log

File "test\test.py", line 50, in main
prompt: str = poml.poml(
~~~~~~~~~^
Path(__file__).parent / "data.poml",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
context=context_dict,
^^^^^^^^^^^^^^^^^^^^^
format="raw",
^^^^^^^^^^^^^
) # pyright: ignore[reportAssignmentType]
^
File ".venv\Lib\site-packages\poml\api.py", line 601, in poml
result = temp_output_file.read()
File "\uv\python\cpython-3.13.2-windows-x86_64-none\Lib\tempfile.py", line 499, in func_wrapper
return func(*args, **kwargs)
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 61: illegal multibyte sequence

EcoleKeine avatar Oct 14 '25 11:10 EcoleKeine

@EcoleKeine Now it has already fixed #140.

icelinks avatar Nov 24 '25 03:11 icelinks

@icelinks the pr is merged but no new version released

EcoleKeine avatar Nov 25 '25 15:11 EcoleKeine