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

Use hex escape sequences instead of octal escape sequences #291

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mingun
Copy link
Contributor

@Mingun Mingun commented Mar 28, 2024

Octal escape sequences the least used form of escape sequences and hex supported almost everywhere. The only outsiders are Java (does not support \xHH form), C++ (unlimited length, so have problems with followed digits) and Rust (limited range of representable characters -- only [0x00; 0x7f]).

Seriously, who decided that using octal escape sequences by default was a good idea?

I've checked all languages and everything (except Java and Rust) are support \xHH form.

@Mingun Mingun force-pushed the hex-escape-seq branch 2 times, most recently from e2f65df to 8fcc010 Compare March 28, 2024 17:18
@Mingun
Copy link
Contributor Author

Mingun commented Mar 28, 2024

This is ready for review.

/** octal escapes (which [[translators.CommonLiterals.strLiteralGenericCC]] uses by default) are not allowed in JSON */
override def strLiteralGenericCC(code: Char): String = strLiteralUnicode(code)
Copy link
Member

Choose a reason for hiding this comment

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

This comment should be updated, not deleted. The fact that we're overriding strLiteralGenericCC at all still deserves an explanation. Nothing has changed about that, because JSON allows neither octal nor hex escapes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Returned back with "hex escapes"

Octal escape sequences the least used form of escape sequences and hex supported everywhere.
The only outsiders are Java, C++ and Rust
Sign up for free to 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