Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape or replace invisible or ambiguous characters when formatting strings #4

Open
novemberborn opened this issue Apr 5, 2017 · 5 comments

Comments

@novemberborn
Copy link
Member

novemberborn commented Apr 5, 2017

Invisible characters such as zero-width joiner and non-breaking space, as well as ambiguous characters like other kinds of spaces, combining characters et cetera should be escaped when strings are formatted.

http://graphemica.com/blocks/control-pictures should be used where the behavior of the original character is preserved. This probably only applies to linebreaks.

If a simple escape sequence exist it should be used. Else characters should be escaped using the \u sequence.

When a string is formatted as a key it must not include linebreaks.

@sindresorhus
Copy link
Member

If a simple escape sequence exist it should be used.

What is a "simple escape sequence"?

@novemberborn
Copy link
Member Author

What is a "simple escape sequence"?

\t would be a simple sequence, as opposed to \u0009.

@novemberborn
Copy link
Member Author

ANSI codes should also be escaped.

@IssueHuntBot
Copy link

@IssueHunt has funded $40.00 to this issue.


@novemberborn
Copy link
Member Author

It'd be great if we could show byte differences when characters look the same, like in this example: avajs/ava#2451

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

No branches or pull requests

3 participants