Skip to content

Fix visualization HTML charset handling#466

Open
Samay10 wants to merge 1 commit into
google:mainfrom
Samay10:fix-visualization-html-charset
Open

Fix visualization HTML charset handling#466
Samay10 wants to merge 1 commit into
google:mainfrom
Samay10:fix-visualization-html-charset

Conversation

@Samay10
Copy link
Copy Markdown
Contributor

@Samay10 Samay10 commented May 2, 2026

Fixes #234

Description

Saved visualization HTML should always be interpreted as UTF-8. Without an explicit charset, some browsers can guess a different encoding based on the user’s system settings that might cause non-ASCII text to render incorrectly.

This change adds a UTF-8 charset meta tag to the HTML returned by visualize(), so saved visualization files render consistently across browsers.

How Has This Been Tested?

  • Ran pyink langextract/visualization.py tests/visualization_test.py --config pyproject.toml
  • Ran pytest tests/visualization_test.py (5 passed)
  • Ran pytest tests; the visualization tests passed, but the full suite still has unrelated local failures from the missing optional openai package and one pip-install plugin discovery test

Checklist

  • My code follows the style guidelines
  • I have self-reviewed my own code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests passed locally with my changes

@github-actions github-actions Bot added the size/XS Pull request with less than 50 lines changed label May 2, 2026
@github-actions
Copy link
Copy Markdown

⚠️ Branch Update Required

Your branch is 1 commits behind main. Please update your branch to ensure CI checks run with the latest code:

git fetch origin main
git merge origin/main
git push

Note: Enable "Allow edits by maintainers" to allow automatic updates.

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

Labels

size/XS Pull request with less than 50 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Browser may display garbled text when <meta charset> is not specified

1 participant