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

Jython doesn't follow PEP263 when parsing files with BOM header #257

Open
myzhan opened this issue Jun 17, 2023 · 1 comment
Open

Jython doesn't follow PEP263 when parsing files with BOM header #257

myzhan opened this issue Jun 17, 2023 · 1 comment

Comments

@myzhan
Copy link

myzhan commented Jun 17, 2023

According to PEP263.

If a source file uses both the UTF-8 BOM mark signature and a magic encoding comment, the only allowed encoding for the comment is ‘utf-8’. Any other encoding will cause an error.

But jython doesn't report an error. It defaults the encoding to utf-8 and run it successfully.

Assuming this file has BOM header.

# coding: iso-8859-15
print("你好")

Jython will run it successfully while CPython will report an error.

@lscoughlin
Copy link

lscoughlin commented Jul 16, 2023

Given the nature of PEP263 and the way CPython (miss?)handled unicode 22 years ago, i'm not sure this is a bug exactly...

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