datamodel-code-generator
datamodel-code-generator copied to clipboard
Add about default encoding to documentation
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.
@schefflaa Thank you for creating this issue. I'm sorry, the usage section is not clear 🤦 Default encoding depends on your environment. https://github.com/koxudaxi/datamodel-code-generator/blob/9842c538cad593f6e253713e3d40561873291d24/datamodel_code_generator/main.py#L50
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?
@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.
OK, I will add it to the documentation Thank you!!