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

UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 51771: character maps to <undefined> #4676

Closed
skupr-anaconda opened this issue Jan 29, 2025 · 1 comment

Comments

@skupr-anaconda
Copy link

We tested sqlglot 26.3.8 on win-64.

Fully reproducible code snippet
The test test_cts_file(self) fails on win-64 with an error:

 def decode(self, input, final=False):
   return codecs.charmap_decode(input,self.errors,decoding_table)[0]
   UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 51771: character maps to <undefined>
     ..\_test_env\lib\encodings\cp1252.py:23: UnicodeDecodeError

The test has a bug.
It should have encoding='utf8' like this:
with open(os.path.join(FIXTURES_DIR, "jsonpath", "cts.json"), encoding='utf8') as file:
instead of:
with open(os.path.join(FIXTURES_DIR, "jsonpath", "cts.json")) as file:

Also, see AnacondaRecipes/sqlglot-feedstock#5

@georgesittas
Copy link
Collaborator

Thanks for reporting this, fixed.

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

2 participants