Skip to content

Template string bug \u003 ? #2141

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
jbondc opened this issue Feb 25, 2015 · 3 comments · Fixed by #2143
Closed

Template string bug \u003 ? #2141

jbondc opened this issue Feb 25, 2015 · 3 comments · Fixed by #2143
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@jbondc
Copy link
Contributor

jbondc commented Feb 25, 2015

var foo = `["m",9536]`;

Emits

var foo = "[\"m\",\u0039536]"; // ?

I came across this by pasting JSON into a template string. Whats '\u003' ?

@DanielRosenwasser DanielRosenwasser added the Bug A bug in TypeScript label Feb 26, 2015
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 1.5 milestone Feb 26, 2015
@DanielRosenwasser DanielRosenwasser self-assigned this Feb 26, 2015
@DanielRosenwasser
Copy link
Member

Good news! That's actually \u0039, which is ASCII 9, so this is technically not wrong.

Bad news: our escaping is broken for cases like this. I'll have a fix out in a bit.

@jbondc
Copy link
Contributor Author

jbondc commented Feb 26, 2015

:) Found fix in
core.ts
var escapedCharsRegExp = /[\0-\x19\t\v\f\b\0\r\n\u2028\u2029\u0085]/g;

@DanielRosenwasser
Copy link
Member

Yup, correcting it now.

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Feb 26, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants