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

BUG: line-length returns wrong number of characters when using special characters #530

Closed
ChristianZimpelmann opened this issue Jan 23, 2023 · 2 comments

Comments

@ChristianZimpelmann
Copy link

The returned number of characters is wrong when using special characters like ä, ö, ü (on Windows).

I have the follwing yaml-file:

---
check: 1
test: ä, ü, ö are special characters. Check whether they influence detected line lenght.

Lenth of line 3 is 88, but yamllint test.yaml returns:

3:89      error    line too long (91 > 88 characters)  (line-length)

Each of those three special characters seem to be counted as two characters.

Two more remarks:

@ChristianZimpelmann ChristianZimpelmann changed the title BUG: line-length returns wrong line length when using special characters (on Windows) BUG: line-length returns wrong line length when using special characters Jan 23, 2023
@ChristianZimpelmann ChristianZimpelmann changed the title BUG: line-length returns wrong line length when using special characters BUG: line-length returns wrong number of characters when using special characters Jan 23, 2023
@adrienverge
Copy link
Owner

Hello,

I guess Windows doesn't load your file with the correct encoding, so Python treats ä, ü, ö as ä, ü, ö.

Have you tried helping Windows/Python use the right encoding (I guess UTF-8)? I don't know much about Windows, but I just read you can use PYTHONUTF8=1 environment variable: https://dev.to/methane/python-use-utf-8-mode-on-windows-212i.

@ChristianZimpelmann
Copy link
Author

That worked! Thank you very much!

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