Skip to content

[suggestion] Specify encoding #5

@franky47

Description

@franky47

The Shortcomings sections mentions:

Importing text with an encoding defined within JavaScript
will require importing it as an Uint8Array,
and explicitly decoding it:

import uint8array from "path/to/file.txt" with { type: "bytes" };
let text = new TextDecoder("utf-16le").decode(uint8array);

Would it be possible to specify the encoding as part of the with block?

import text from "path/to/file.txt" with { type: "text", encoding: "utf-16le" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions