Skip to content

http.writeFile API fails with non-ascii characters  #912

@lancetarn

Description

@lancetarn

Describe the bug
Using writeFile API with unicode payload results in failed to match a command error.

To Reproduce
Implement a minimal function:

import {
  Dir, writeFile,
} from 'tauri/api/fs';

function pleaseWrite() {
  writeFile({ path: 'unicodeTest.txt', contents: 'å' }, { dir: Dir.Cache });
}

Receive the subsequent error in WebView console:

failed to match a command for {"callback":"499c79fd-8dde-4720-e708-d94956083059","error":"b4aa06f4-a06f-45b1-66d5-b69bdc463d43","cmd":"writeFile","path":"unicodeTest.txt","contents":"å","options":{"dir":2}}], trailing characters at line 1 column 178

Expected behavior
The file contents are written without error.

Platform and Versions (please complete the following information):

OS: macOS 10.14.6
Node: 12.18.0
NPM: 6.14.4
Yarn: -
Rustc: 1.45.0

taurijs: 0.11.0 (also appears in 0.10.0)
tauri.rs: 0.9.0 (also appears in 0.8.0)

Additional context
I realize that I have only been trying this in dev.

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