Skip to content

Use hex escape sequences instead of octal escape sequences#291

Open
Mingun wants to merge 1 commit intokaitai-io:masterfrom
Mingun:hex-escape-seq
Open

Use hex escape sequences instead of octal escape sequences#291
Mingun wants to merge 1 commit intokaitai-io:masterfrom
Mingun:hex-escape-seq

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.

Comment on lines 30 to 31

/** 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"

@Mingun Mingun requested a review from generalmimon August 25, 2024 17:06
@Mingun Mingun force-pushed the hex-escape-seq branch 2 times, most recently from 81600d2 to 2a5c7d2 Compare December 24, 2025 16:37
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