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

Add about default encoding to documentation #339

Open
schefflaa opened this issue Feb 16, 2021 · 3 comments
Open

Add about default encoding to documentation #339

schefflaa opened this issue Feb 16, 2021 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@schefflaa
Copy link

Describe the bug
In the usage section it is stated that the default encoding is utf-8. However the comand line paramater has to be set explicitly in order to properly transform the code. Otherwise some characters are displayed as �.

Used commandline:

$ datamodel-codegen --input api.yaml --output model.py

Expected behavior
The correct transformation of umlauts (among others)

Version:

  • OS: Windows 10
  • Python version: 3.9.1
  • datamodel-code-generator version: 0.7.3

Additional context
datamodel-codegen --encoding utf-8 --input api.yaml --output model.py did work fine.

@koxudaxi
Copy link
Owner

@schefflaa
Thank you for creating this issue.
I'm sorry, the usage section is not clear 🤦
Default encoding depends on your environment.

DEFAULT_ENCODING = locale.getpreferredencoding()

I wanted to keep the same behavior, and I set the value.
But, I think changing default encoding to 'utf-8' may be better than the current behavior.

How do you feel about it?

@schefflaa
Copy link
Author

@koxudaxi
Absolutely no problem! In my opinion either way would be fine, so go with it as you like, I'd just make sure to properly mention the behaviour of the default encoding in the readme file.

@koxudaxi koxudaxi added the documentation Improvements or additions to documentation label Feb 16, 2021
@koxudaxi koxudaxi changed the title UTF-8 is not the default encoding Add about default encoding to documentation Feb 16, 2021
@koxudaxi
Copy link
Owner

OK, I will add it to the documentation
Thank you!!

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

No branches or pull requests

2 participants