Skip to content

Fix string with escape characters using existing string with escaped characters - #31

Closed
jordoh wants to merge 2 commits into
rgcl:masterfrom
jordoh:escape-character-mis-packing
Closed

Fix string with escape characters using existing string with escaped characters#31
jordoh wants to merge 2 commits into
rgcl:masterfrom
jordoh:escape-character-mis-packing

Conversation

@jordoh

Copy link
Copy Markdown

After packing a string containing an escaped character, a subsequent string containing the escape character would erroneously use the string with the escaped character. I've included a test that demonstrates this behavior.

This PR updates the string re-use check to escape the string before checking for a matching string in the dictionary.

jordohand others added 2 commits July 23, 2024 14:02
Fixes a string containing a single space (" ") being used as the string for a string containing a single plus sign ("+").
@rgcl

rgcl commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Hi @jordoh — first of all, I sincerely apologize for the 3-year wait on this. The project had been abandoned for years and I'm only now coming back to it.

Your diagnosis is correct: the lookup was comparing against unencoded strings while the dictionary stored encoded ones, so strings with special characters were never deduplicated. That's a real bug and your fix is clean.

I'm going to close this in favor of #27, which fixes the exact same issue but as part of a broader refactor that switches the dictionary from arrays to objects (O(1) lookup). Since both touch the same lines and #27 covers your fix, merging both would create unnecessary conflicts.

Your contribution helped confirm the bug and the test you added is genuinely useful. Thank you.

@rgclrgcl closed this Jun 20, 2026
Sign up for freeto 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.

2 participants

@jordoh@rgcl