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

UTF-8 characters as object keys #164

Closed
rolandliwag opened this issue Mar 26, 2015 · 9 comments
Closed

UTF-8 characters as object keys #164

rolandliwag opened this issue Mar 26, 2015 · 9 comments

Comments

@rolandliwag
Copy link

This bit of html breaks in IE11 because buildProduction strips the quotes around the object properties.

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <script>

    var i={"ဇ":"z","စျ":"za","ည":"ny"};

    </script>
</head>
<body></body>
</html>

IE does not like this for some reason. This is a small snippet of code taken from speakingurl.

@Munter
Copy link
Member

Munter commented Mar 26, 2015

Thanks for the feedback. We're aware of the problem. It's tracked here: assetgraph/assetgraph#111

It's a problem with uglifyjs, and thus a bit out of our hands. The issue still seems to be unresolved mishoo/UglifyJS#54

@papandreou
Copy link
Member

Does buildProduction --asciionly work?

@rolandliwag
Copy link
Author

@papandreou IE still complains about it. It turns it into:

var i={\u1007:"z",\u1005\u103b:"za",\u100a:"ny"};

@papandreou
Copy link
Member

Then I'm afraid the only option is patching uglify-js. The good news is that we're already using a fork. See if you can implement a OutputStream (lib/output.js) option that fixes this, then PR it to https://github.com/papandreou/uglifyjs2

@papandreou
Copy link
Member

Ah, wait. There is also --quotekeys, which produces this output:

var i={"ဇ":"z","စျ":"za","ည":"ny"}

I just fixed a quirk with how the boolean command line options are parsed and released assetgraph-builder 3.2.0. Either upgrade to that and use buildProduction --quotekeys.

(otherwise you will have to use buildProduction --quotekeys true, which will break when you upgrade.

@papandreou
Copy link
Member

And if that does not work either, try --asciionly --quotekeys, which gives you:

var i={"\u1007":"z","\u1005\u103b":"za","\u100a":"ny"};

@rolandliwag
Copy link
Author

Hey quotekeys should be enough and sort of preferred in my opinion since it is exactly how the original source looks (and works in IE). Thanks!

@Munter
Copy link
Member

Munter commented Mar 29, 2015

Maybe we should make it the default. I'd really like us to automatically fix all of these corner cases developers should never have to think about

@papandreou
Copy link
Member

I agree. It should be the default in UglifyJs, though. Turning on --quotekeys for everything will result in many unnecessary quotes as well.

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

3 participants