remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.13k stars 1.72k forks source link

Input input cyrillic char's in python input work not well #2198

Closed wennerryle closed 1 month ago

wennerryle commented 2 months ago

Thank you very much for this great library! I have issues with encoding in python. When I write russian word test into console it should pass the test, but it don't work well. I also test just without nodemon and it works

Steps to create this behaviour:

if test_str == inputed_str: print("test passed") else: print(f"test_str is: {inputed_str}, expected: {test_str}")

- write `nodemon test.py`
- insert `тест` into command line
- press enter
- do it again but just with python

### Expected behaviour

js-everywhere@DESKTOP-AUFNKKJ MINGW64 ~/3D Objects/projects/text_correlation $ nodemon test.py [nodemon] 3.0.3 [nodemon] to restart at any time, enter rs [nodemon] watching path(s): . [nodemon] watching extensions: py,json
[nodemon] starting python test.py тест test passed


### NOT expected behaviour
```sh
$ nodemon test.py 
[nodemon] 3.0.3
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: py,json      
[nodemon] starting `python test.py`
тест
test_str is: теÑ�Ñ‚, expected: тест
[nodemon] clean exit - waiting for changes before restart

If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.

Dump is there:

$ nodemon test.py --dump
[nodemon] 3.0.3
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: py,json
--------------
node: v21.6.0
nodemon: 3.0.3
command: C:\Program Files\nodejs\node.exe C:\Users\js-everywhere\AppData\Roaming\npm\node_modules\nodemon\bin\nodemon.js test.py --dump
cwd: C:\Users\js-everywhere\3D Objects\projects\text_correlation
OS: win32 x64
--------------
{
  run: false,
  system: {
    cwd: 'C:\\Users\\js-everywhere\\3D Objects\\projects\\text_correlation'
  },
  required: false,
  dirs: [
    'C:\\Users\\js-everywhere\\3D Objects\\projects\\text_correlation'
  ],
  timeout: 1000,
  options: {
    dump: true,
    ignore: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**',
      re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
    ],
    watch: [ '*.*', re: /.*\..*/ ],
    monitor: [
      '*.*',
      '!**/.git/**',
      '!**/.nyc_output/**',
      '!**/.sass-cache/**',
      '!**/bower_components/**',
      '!**/coverage/**',
      '!**/node_modules/**'
    ],
    ignoreRoot: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**'
    ],
    restartable: 'rs',
    colours: true,
    execMap: { py: 'python', rb: 'ruby', ts: 'ts-node' },
    stdin: true,
    runOnChangeOnly: false,
    verbose: false,
    signal: 'SIGUSR2',
    stdout: true,
    watchOptions: {},
    execOptions: {
      script: 'test.py',
      exec: 'python',
      args: [],
      scriptPosition: 0,
      nodeArgs: undefined,
      execArgs: [],
      ext: 'py,json',
      env: {}
    }
  },
  load: [Function (anonymous)],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  watchInterval: null,
  signal: 'SIGUSR2',
  command: {
    raw: { executable: 'python', args: [ 'test.py' ] },
    string: 'python test.py'
  }
}
--------------
github-actions[bot] commented 2 months ago

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3

remy commented 1 month ago

@wennerryle I suspect this is actually a terminal encoding problem - I ran the code on my Mac (appreciate it's a different system) and it works as expected:

SCR-20240519-jqnl-min

I'm on a different minor version to you, but I'm fairly sure the version of nodemon won't make a difference and it's actually the OS + terminal that needs to be configured to a consistent character encoding. However, I've no idea how you configure Windows + gitshell + vscode.

If it helps, nodemon is reading the stream as UTF-8 - if you can try to configure your vscode terminal to use that and see how you get on.

Closing as this doesn't appear to be a nodemon specific issue.