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

syntax error in beautified code when using "unescape-strings" (Unescape printable chars encoded as \xNN or \uNNNN) #2267

Open
TheFalloutOf76 opened this issue Apr 27, 2024 · 0 comments

Comments

@TheFalloutOf76
Copy link

TheFalloutOf76 commented Apr 27, 2024

Description

when using the "unescape-strings" (Unescape printable chars encoded as \xNN or \uNNNN) feature, some encoded characters cause a new line to be created, which is a syntax error in the code

Input

The code looked like this before beautification:

let encodedString = '\u2028';
let encodedString2 = '\u2029';

console.log(encodedString, encodedString2);

Expected Output

The code should have looked like this after beautification:

let encodedString = '
';
let encodedString2 = '
';

console.log(encodedString, encodedString2);

Actual Output

The code actually looked like this after beautification:

let encodedString = '
';
let encodedString2 = '
';

console.log(encodedString, encodedString2);

Steps to Reproduce

  1. go to https://beautifier.io/
  2. enable "Unescape printable chars encoded as \xNN or \uNNNN"
  3. paste in code below:
let encodedString = '\u2028';
let encodedString2 = '\u2029';

console.log(encodedString, encodedString2);
  1. error in beautified code

Environment

OS: Web

Settings

Example:

{
  "indent_size": "4",
  "indent_char": " ",
  "max_preserve_newlines": "5",
  "preserve_newlines": true,
  "keep_array_indentation": false,
  "break_chained_methods": false,
  "indent_scripts": "normal",
  "brace_style": "end-expand",
  "space_before_conditional": false,
  "unescape_strings": true,
  "jslint_happy": false,
  "end_with_newline": false,
  "wrap_line_length": "0",
  "indent_inner_html": false,
  "comma_first": false,
  "e4x": false,
  "indent_empty_lines": false
}
@TheFalloutOf76 TheFalloutOf76 changed the title syntax error when using "Unescape printable chars encoded as \xNN or \uNNNN" syntax error when using "unescape-strings" (Unescape printable chars encoded as \xNN or \uNNNN) Apr 27, 2024
@TheFalloutOf76 TheFalloutOf76 changed the title syntax error when using "unescape-strings" (Unescape printable chars encoded as \xNN or \uNNNN) syntax error in beautified code when using "unescape-strings" (Unescape printable chars encoded as \xNN or \uNNNN) Apr 27, 2024
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

No branches or pull requests

1 participant