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] [Formatter]This breaks when formatting a django template with Japanese characters in UTF-8. #243

Closed
Taikono-Himazin opened this issue May 12, 2022 · 7 comments
Labels

Comments

@Taikono-Himazin
Copy link

Running the following command produces corrupted output.

echo "{% if field.field.required %}\n<span span class=\"badge badge-danger\">{{ required | default:'必須' }}</span>\n{% endif %}" | djlint - --reformatmat

output

{% if field.field.required %}\n<span span class=\ badge badge-danger\>{{ required | default:'??' }}</span>\n{% endif %}

Do you only deal with ascii characters in djlint?
I noticed that when using djlint-vscode with vscode, I get corrupted output.
When I tried the above command, djlint gave corrupted output.

Below is my environment.

  • OS -Windows 10 Japanese
  • Python 3.9.10
  • djLint version -1.0.2
@Taikono-Himazin Taikono-Himazin added 🦠 bug Something isn't working 🧽 formatter labels May 12, 2022
@monosans
Copy link
Member

According to my observations, the issue is only on Windows.

@Taikono-Himazin
Copy link
Author

If you turn on "Beta: Use Unicode UTF-8 with worldwide language support" in the system locale setting of windows, you can do it without any problem.
It seems to be a problem with windows settings. Thank you.

@christopherpickering
Copy link
Contributor

Thanks @Taikono-Himazin and @monosans!

@christopherpickering
Copy link
Contributor

Reopening to fix this:

christopherpickering pushed a commit that referenced this issue May 18, 2022
# [1.1.0](v1.0.3...v1.1.0) (2022-05-18)

### Bug Fixes

* **dj018:** fix rule DJ018 for special attrib names ([f63cc4d](f63cc4d)), closes [#248](#248)
* **stdin encoding:** added encoding to stdin text ([e906b3e](e906b3e)), closes [#243](#243)

### Features

* **breaks:** allowed p, head, and body tags that are short/empty to be on a single line ([886d590](886d590))
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Taikono-Himazin
Copy link
Author

After applying this update, it worked fine even if I restored the Windows settings!
thank you!

@christopherpickering
Copy link
Contributor

Nice! Thank you!

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

No branches or pull requests

3 participants