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

Added option for inputting encoding of file #334

Closed
wants to merge 3 commits into from

Conversation

mmzeynalli
Copy link
Contributor

Now you can also give --encoding or -e option to indicate the encoding of input file

mmzeynalli and others added 3 commits March 16, 2023 01:46
Now you can also give --encoding or -e option to indicate the encoding of input file
@yyamano
Copy link
Contributor

yyamano commented Aug 10, 2023

I'm trying to merge the the change to the latest master on https://github.com/yyamano/fastapi-code-generator/tree/issue-334

@mmzeynalli @koxudaxi I want to hear your opinion about default encoding.

https://github.com/koxudaxi/fastapi-code-generator/compare/master...yyamano:issue-334?expand=1#diff-0f0c57a0e82e5336af024b8607c04a05bb44a8a410be1d42ba1826c283e5705fR46

encoding: str = typer.Option("cp1252", "--encoding", "-e"),

I don't think cp1252 is a good default value. utf-8 or platform default encoding (utf-8 on linux, shift_jis on japanese version of windows, etc) is better.

Python's platform default encoding on Windows is changing by PEP 686.

What are your thoughts on this?

yyamano added a commit to yyamano/fastapi-code-generator that referenced this pull request Aug 23, 2023
cp1252 is a superset of iso-8859-1. I don't think it is a good default value.
See koxudaxi#334 (comment)
Fixed koxudaxi#334
@koxudaxi
Copy link
Owner

koxudaxi commented Sep 7, 2023

@yyamano
I'm sorry for my late reply.
https://docs.python.org/3/library/locale.html#locale.getpreferredencoding
I prefer locale.getpreferredencoding() to get default encoding.
I use it in datamodel-code-generator

@koxudaxi koxudaxi closed this in #383 Sep 7, 2023
koxudaxi added a commit that referenced this pull request Sep 7, 2023
Fixed broken test (Added option for inputting encoding of file #334)
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

Successfully merging this pull request may close these issues.

None yet

3 participants