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

[bug] @tauri-apps/api/shell exists utf8 parsing error on window #4644

Closed
horochx opened this issue Jul 10, 2022 · 9 comments
Closed

[bug] @tauri-apps/api/shell exists utf8 parsing error on window #4644

horochx opened this issue Jul 10, 2022 · 9 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@horochx
Copy link
Contributor

horochx commented Jul 10, 2022

Describe the bug

When I use the simplified Chinese version of window, the console will return GBK encoded data and an invalid utf-8 sequence of 1 bytes from index 0 error will occur. I think all non-English versions of window may have that problem.

Reproduction

  1. import { Command } from '@tauri-apps/api/shell';
  2. new Command('cmd', ['/C','echo 你好,世界']).execute();

After that, you will get the error.

Expected behavior

No string parsing errors.

Platform and versions

Environment
  › OS: Windows 10.0.19044 X64
  › Webview2: 103.0.1264.49
  › MSVC: 
      - Visual Studio ���ɹ��� 2019
  › Node.js: 16.15.1
  › npm: 8.11.0
  › pnpm: Not installed!
  › yarn: Not installed!
  › rustup: 1.24.3
  › rustc: 1.62.0
  › cargo: 1.62.0
  › Rust toolchain: stable-x86_64-pc-windows-msvc 

Packages
  › @tauri-apps/cli [NPM]: 1.0.0 (outdated, latest: 1.0.3)
  › @tauri-apps/api [NPM]: 1.0.1 (outdated, latest: 1.0.2)
  › tauri [RUST]: 1.0.0,
  › tauri-build [RUST]: 1.0.0,
  › tao [RUST]: 0.11.2,
  › wry [RUST]: 0.18.3,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../build
  › devPath: http://localhost:3000/
  › framework: React

App directory structure
  ├─ .git
  ├─ .vscode
  ├─ build
  ├─ node_modules
  ├─ public
  ├─ rumqtt
  ├─ scripts
  ├─ src
  └─ src-tauri

Stack trace

No response

Additional context

In fact, I think the error comes from this line,and I'd be happy to submit a PR in a few days to allow the user to specify the encoding (default utf-8) if you agree.

@horochx horochx added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jul 10, 2022
@mfts2048
Copy link

By the way, has the problem been solved

@horochx
Copy link
Contributor Author

horochx commented Jul 26, 2022

By the way, has the problem been solved

Sorry, I've been busy with work lately and I probably won't have time to address this issue until this weekend.

@mfts2048
Copy link

Thank you very much
May I ask what your test case is?
image
image
image

It's like powershell

I don't know if I was wrong

@mfts2048
Copy link

I am Windows

@horochx
Copy link
Contributor Author

horochx commented Jul 27, 2022

Thank you very much May I ask what your test case is? image image image

It's like powershell

I don't know if I was wrong

use Encoding gbk instead of utf-8, it'll work :D

@mfts2048
Copy link

mfts2048 commented Jul 27, 2022

Thank you for helping me with the coding problem
In fact,Its a problem, I needed it to run on CMD instead of Powershell

@mfts2048
Copy link

mfts2048 commented Jul 27, 2022

image
image

@horochx
Copy link
Contributor Author

horochx commented Jul 27, 2022

image image

This issue is not related to tauri. I guess it should work like this in PowerShell: get-wmiobject -query "select * from win32_process where name='QQMusic.exe'". For more details, please refer to the relevant official documentation.

@mfts2048
Copy link

good, Thank you for your great help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants