Skip to content

Improper string escaping #21828

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

Closed
clydin opened this issue Feb 9, 2018 · 0 comments
Closed

Improper string escaping #21828

clydin opened this issue Feb 9, 2018 · 0 comments
Assignees
Labels
Bug A bug in TypeScript

Comments

@clydin
Copy link
Contributor

clydin commented Feb 9, 2018

TypeScript Version: 2.6+

Search Terms:

Code

const a1 = "\0";
const b1 = "\x01";
const c1 = "\01";
const d1 = "\\0041";

const a2 = `\0`;
const b2 = `\x01`;
const c2 = `\01`;
const d2 = `\\0041`;

Expected behavior:

var a1 = "\0";
var b1 = "\x01"; // this should be consistency with b2
var c1 = "\01";  // this should either remain as is or be "\u0001"
var d1 = "\\0041";
var a2 = "\0";
var b2 = "\u0001";
var c2 = "\01";  // this should either remain "\01" or be "\u0001" (same as c1)
var d2 = "\\0041";  // This should not be altered

Actual behavior:

var a1 = "\0";
var b1 = "\x01";  
var c1 = "\01"; 
var d1 = "\\0041";
var a2 = "\0";
var b2 = "\u0001";
var c2 = "\x001";
var d2 = "\\x00041";   // This is broken and the main concern

The behavior demonstrated in variable d2 is the primary concern as the output has been transformed into a completely different value.

Playground Link:
Example

Related Issues:

Traced the change to this PR: #18026

angular/angular-cli#9567

@mhegazy mhegazy added the Bug A bug in TypeScript label Feb 9, 2018
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 2.8 milestone Feb 9, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants