Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't render when comments contain non-ASCII characters #17

Open
HaleyHalcyon opened this issue Sep 26, 2024 · 0 comments
Open

Can't render when comments contain non-ASCII characters #17

HaleyHalcyon opened this issue Sep 26, 2024 · 0 comments

Comments

@HaleyHalcyon
Copy link

I tried to render a shader, but loading it raised a text encoding error. This error arose at several different parts of the code:

Traceback (most recent call last):
  File "D:\Downloads\shadertoy-render\shadertoy-render.py", line 926, in <module                                     >
    glsl_shader = open(args.input, 'r').read().encode('ascii', errors='ignore').                                     decode()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'cp932' codec can't decode byte 0x99 in position 2192: illeg                                     al multibyte sequence

This is a typical error caused by not specifying a character encoding to the open function, and can be fixed by adding , encoding='utf-8' to the function's parameters.

There should not be any incompatibility issues, since UTF-8 is backwards compatible to ASCII in the 0x00~0x7F range, the only range that GLSL cares about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant