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

The exported result is incorrect if the document had not UTF-8 encoding #497

Open
yhatt opened this issue Mar 5, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@yhatt
Copy link
Member

yhatt commented Mar 5, 2025

Version of Marp Tool

Marp for VS Code v3.1.0

Operating System

macOS

Environment

OS version: macOS Sequoia 15.3.1
VS Code version (Marp for VS Code): VS Code 1.97.2

How to reproduce

  1. Create a new Markdown file just like this:
🐣
  1. Save Markdown file with UTF-16 LE encoding
  2. Export slide deck to any format.

Expected behavior

Show a slide page with the content 🐣

Actual behavior

A slide page has incorrect encoding.

Additional information

Originally reported in marp-team/marp#558.

Extension could not deal with that due to lack of VS Code API for getting a encoding for the current document. But now the latest VS Code 1.98 has a newly proposed API for getting encoding.
https://code.visualstudio.com/updates/v1_98#_text-encodings
https://github.com/microsoft/vscode/blob/501ee833b16b8e83ba656c46e0888aadd9d2db04/src/vscode-dts/vscode.proposed.textDocumentEncoding.d.ts#L1

To fix that, Marp for VS Code should use an temporary file as an input if detected non UTF-8 encoding.

if (doc.uri.scheme === 'file' && !doc.isDirty) {

@yhatt yhatt added bug-triage May be a bug and needs triage bug Something isn't working and removed bug-triage May be a bug and needs triage labels Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant