Skip to content

Input/Output issues on non UTF-8 platforms with Python 3 (e.g. Windows) #34

Description

@schlenk

I tried to run the LSL-PyOptimizer with the AVSitter/AVSitter repository makefile (e.g. https://github.com/AVsitter/AVsitter/blob/master/AVsitter2/Makefile )

This fails with a Python 3.13 install on Windows, due to the default I/O-encoding for newly opened files being CP1252 (german windows) instead of CP65001.

So processing the UTF-8 encoded files, it blows up reading the input and writing the output files, as open() defaults to the system encoding instead of UTF-8. I would assume stdio has similar issues (unless setup with PYTHONIOENCODING).

I hacked together a solution for me, simply using binary read and explicit encoding on output. Thats obviously not the proper way to do it for a mixed mode py2/py3 script, but may be helpful for others stumbling on this issue.

winfix.patch

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions