Skip to content

fix: make hash persistence unicode-safe#367

Open
Pixel998 wants to merge 1 commit intomainfrom
fix/unicode-safe-hash-persistence
Open

fix: make hash persistence unicode-safe#367
Pixel998 wants to merge 1 commit intomainfrom
fix/unicode-safe-hash-persistence

Conversation

@Pixel998
Copy link
Copy Markdown
Contributor

Prerequisites checklist

AI acknowledgment

  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

What is the purpose of this pull request?

This PR fixes explorer state persistence when the edited code contains Unicode characters. Previously, writing the shareable URL hash could throw InvalidCharacterError because the app used btoa(...) on a string containing characters outside the Latin1 range.

Steps to reproduce

  1. Replace the editor contents with code containing non-Latin-1 characters, for example:
const π = "😀";
  1. Open the browser console.
  2. Observe this error when the app tries to write the hash:
InvalidCharacterError: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.

What changes did you make? (Give an overview)

  • Updated hash persistence to use a versioned UTF-8-safe format for newly generated links while preserving support for legacy links.
  • Added e2e coverage.

Related Issues

I ran into this while working on eslint/markdown#640, where I noticed that emojis in the editor were no longer present after a reload.

Is there anything you'd like reviewers to focus on?

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 28, 2026

Deploy Preview for eslint-code-explorer ready!

Name Link
🔨 Latest commit ff40263
🔍 Latest deploy log https://app.netlify.com/projects/eslint-code-explorer/deploys/69c8455c1a9e6f0008e099d6
😎 Deploy Preview https://deploy-preview-367--eslint-code-explorer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Mar 28, 2026
@eslintbot eslintbot added this to Triage Mar 28, 2026
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Mar 28, 2026
Copy link
Copy Markdown
Member

@amareshsm amareshsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I’ll keep it open for another day in case anyone else wants to review.

@amareshsm amareshsm added the accepted There is consensus among the team that this change meets the criteria for inclusion label Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accepted There is consensus among the team that this change meets the criteria for inclusion bug Something isn't working

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

3 participants