Skip to content

Commit

Permalink
Fix bug causing "|" to encode as apostrophe (#35)
Browse files Browse the repository at this point in the history
These regexes use both square-bracketed character classes and the `|`
operator at the same time, when they only actually need to use one or
the other. Since `|` doesn't mean anything special inside a character
class, this causes literal `|` characters in clues to be converted to
apostrophes.
  • Loading branch information
rf- authored May 13, 2023
1 parent d57433d commit d365dc9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions @confuzzle/puz-common/puz-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,19 @@ function splitNulls(buf, encoding) {
function replaceWordChars(text) {
var s = text;
// smart single quotes and apostrophe
s = s.replace(/[\u2018|\u2019|\u201A]/g, "\'");
s = s.replace(/\u2018|\u2019|\u201A/g, "\'");
// smart double quotes
s = s.replace(/[\u201C|\u201D|\u201E]/g, "\"");
s = s.replace(/\u201C|\u201D|\u201E/g, "\"");
// ellipsis
s = s.replace(/\u2026/g, "...");
// dashes
s = s.replace(/[\u2013|\u2014]/g, "-");
s = s.replace(/\u2013|\u2014/g, "-");
// circumflex
s = s.replace(/\u02C6/g, "^");
// open angle bracket
s = s.replace(/\u2039/g, "");
// spaces
s = s.replace(/[\u02DC|\u00A0]/g, " ");
s = s.replace(/\u02DC|\u00A0/g, " ");
return s;
}

Expand Down

0 comments on commit d365dc9

Please sign in to comment.