Skip to content

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

@horochx

Description

@horochx

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions