Replace em dash in serialize-dialog.js comment w/ ASCII dash#2203
Conversation
The em dash (U+2014 EM DASH) being replaced in this change with a simple dash (U+002D HYPHEN-MINUS) causes a problem for me (and maybe/probably other people). The em dash ultimately causes Ruby's HTTP library (which I use via the `percy-capybara` gem) to interpret a certain HTTP response from the Percy server as having a binary encoding, rather than a UTF-8 encoding, which then causes a warning from the `json` gem (`/home/runner/work/david_runger/david_runger/vendor/bundle/ruby/4.0.0/gems/json-2.19.4/lib/json/common.rb:445: warning: JSON.generate: UTF-8 string passed as BINARY, this will raise an encoding error in json 3.0`). Replacing the em dash with a simple ASCII dash avoids this issue. The non-ASCII dash was introduced in the latest released Percy version (1.31.12) via percy#2185.
|
As a side note, I see that the bottom of the PR #2185 (cc author @yashmahamulkar-bs) that introduced the issue that this PR aims to correct states:
I certainly appreciate that transparency! LLMs are well known for their fondness for em dashes. If it is possible to take some measure to minimize the likelihood of LLM agents such as Claude Code from introducing em dashes into code (e.g. by adding an |
|
Hi, @davidrunger thanks for raising the issue and appreciate your efforts on fixing this. I have ran the spec and will merge it as the specs passes. |
|
This PR is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
|
I'm commenting to try to remove the stale label. I will appreciate if this PR can be merged. Thank you! |
|
Hi, @davidrunger thank you for making this contribution, your changes are released in beta version: 1.32.0-beta.2. In our next stable release cycle it will be available in stable release v1.32.0 |
|
@this-is-shivamsingh Thank you very much for the merge and for releasing this change in a beta version (and for planning it for inclusion in the next stable release)! I tried out the Here are a few semi-randomly selected examples of recent PRs that have introduced more non-ASCII characters (linking to specific lines that introduce non-ASCII characters):
I strongly suspect that probably almost all of the non-ASCII characters being added to the codebase were generated by LLM(s). That's why I had suggested in this comment that it might be a good idea to, for example, add an Additionally, in case the LLMs are not perfectly obedient to that instruction (or in case a human tries to add a non-ASCII character to a code file), it would probably also be a good idea to add a check to CI that there are no non-ASCII characters in code files in the codebase, and which will fail if there are any non-ASCII characters in code files in the codebase. Alongside those changes (i.e. something like an I realize that I'm sort of presuming to make a somewhat non-trivial proposal, but I think that this (or some other fix) is worth doing. As mentioned in my PR description, currently I think that users of the There might be (indeed, I think, there probably is) some alternative way to avoid the issue that is caused by non-ASCII characters in the compiled JavaScript file(s?), such as perhaps by making some change to the |
The em dash (U+2014 EM DASH) that is being replaced in this change with a simple dash (U+002D HYPHEN-MINUS) causes a problem for me (and maybe/probably other people). The em dash ultimately causes Ruby's HTTP library (which I use via the
percy-capybaragem) to interpret a certain HTTP response from the Percy server as having a binary encoding, rather than a UTF-8 encoding, which then causes a warning from thejsongem (/home/runner/work/david_runger/david_runger/vendor/bundle/ruby/4.0.0/gems/json-2.19.4/lib/json/common.rb:445: warning: JSON.generate: UTF-8 string passed as BINARY, this will raise an encoding error in json 3.0).Replacing the em dash with a simple ASCII dash avoids this issue.
The non-ASCII dash was introduced in the latest released Percy version (1.31.12) via #2185.