Skip to content

fix(latex): set utf-8 python io encoding for windows - #687

Open
AtifChy wants to merge 1 commit into
MeanderingProgrammer:mainfrom
AtifChy:fix/windows
Open

AtifChy wants to merge 1 commit into
MeanderingProgrammer:mainfrom
AtifChy:fix/windows

Conversation

@AtifChy

@AtifChy AtifChy commented Sep 14, 2026

Copy link
Copy Markdown

Summary

Fixes LaTeX rendering on Windows when latex2text emits Unicode math symbols that cannot be represented by the active Windows code page.

The converter now runs with PYTHONIOENCODING=utf-8, which prevents Python-based latex2text executables from failing with encoding errors when stdout is redirected.

Before After
image image

Details

  • Sets PYTHONIOENCODING=utf-8 for the vim.system converter path.
  • Temporarily sets and then restores vim.env.PYTHONIOENCODING for the legacy vim.fn.system fallback.
  • Preserves any existing user environment value so the plugin does not leak global environment changes into later processes.
  • Adds test coverage to ensure the modern converter path passes the UTF-8 environment.

Verification

  • Confirmed the failing sample now converts successfully on Windows.
  • All tests passed.

@AtifChy

AtifChy commented Sep 15, 2026

Copy link
Copy Markdown
Author

@MeanderingProgrammer this is ready for merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant