Console script in windows can't take unicode arguments[BUG]
See original GitHub issuesetuptools version
60.4.2
Python version
3.9
OS
Windows10
Additional environment information
No response
Description
setup.py consolescripts can’t take unicode command line arguments on windows, while the respective .py file can.
e.g. all_dl.py
console_script in setup.py: all-dl=all_dl:main
def main(): print(sys.argv[1])
if name == “main”: main()
python all_dl.py एक परिचय
ouputs एक परिचय.
but
all-dl एक परिचय.
outputs ???
Expected behavior
The latter output should be similar to former
How to Reproduce
- Write the small py file
- make a console script for that file
- pass unicode arg to py file and the exe file
- See the difference
Output
1st case - एक परिचय. 2nd case - ???
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to use unicode characters in Windows command line?
The most secure solution is this one: Go to your Registry key HKEY_CURRENT_USER\Software\Microsoft\Command Processor and add String value Autorun = chcp 65001 ....
Read more >Issue 1602: windows console doesn't print or input Unicode
msg58487 ‑ (view) Author: Mark Summerfield (mark) * Date: 2007‑12‑12 09:56
msg58621 ‑ (view) Author: Mark Summerfield (mark) * Date: 2007‑12‑14 11:31
msg58651 ‑ (view)...
Read more >Unicode and UTF-8 Output Text Buffer - Windows Command ...
In this post, we'll discuss the improvements we've been making to the Windows Console's internal text buffer, enabling it to better store and...
Read more >78584 – [Win32] Unicode character suppport for the command ...
On Windows, The user can not specify any Unicode characters not existing in OS native charset in the command line arguments, and args...
Read more >Accepting Command Line Arguments - Learn Rust
The args Function and Invalid Unicode. Note that std::env::args will panic if any argument contains invalid Unicode. If your program needs to accept...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To correctly take input and print output of a given character range, you must use a console capable of receiving and emitting an encoding covering the character range, and have your application use that encoding. There are modern tools on Windows that can handle this correctly, but your environment may not.
The bottom line is, this is not a bug in pip (or setuptools, or distlib, or Python), but just how old Windows things do not handle non-ASCII well. You may have better luck finding help on a general Python Q&A forum, or a local user group (where people tend to have more experience dealing with the local language).
Thank you very much @uranusjr for clarifying the problem.
I think I will go ahead and close this issue, since there isn’t a direct action point.