Skip to content

Issue with compressing escaped UTF8 characters #54

@lehni

Description

@lehni

I am running into an issue when attempting to compress Acorn.js or Esprima.js for browser use:

Both libraries contain regular expressions that are full of escaped UTF8 characters (Look for NonAsciiIdentifierStart in Esprima, for example).

UglifyJS reads these, resolves the escaped characters, and then outputs them to real UTF8 characters.

Loading this compressed library on WebKit then causes an exception:

Invalid regular expression: range out of order in character class

Using UglifyJS1, I could pass --ascii to the compressor, solving this issue, but leading to an increased file-size of the result (about 4kb more, since all non-ascii chars would now be escaped).

In UglifyJS2, when passing -b ascii_only=true, I do not get any compressed output anymore. I believe, since the beautifier is activated, -c is ignored.

But Ideally, I would like an option that would allow me to just preserve these strings in their current form, including all escaping that they contain.

Depending on the JS parser in use, this might be hard to implement though.

What do you suggest?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions