Skip to content

Do not escape characters in string literals when they are supported by the specified encoding #619

@tyrak

Description

@tyrak

I was experimenting with babili and found that the minified code it produces is significantly larger than closure (100 KiB vs 120 KiB). As it turns out, the problem is caused by the way babili handles (unicode) string literals.

Suppose that the code contains the string "теѕт" (all Cyrillic characters). Then babili converts it to "\u0442\u0435\u0455\u0442". OTOH, closure with the --charset utf8 option leaves the string in the original form. In fact, with that flag, closure converts "\u0442\u0435\u0455\u0442" to "теѕт".

So I propose to introduce to babili an option similar to closure's --charset. Of course, this should use a conservative setting by default (eg ascii), because otherwise the minified script would then require to be loaded with charset="..." in the <script> tag.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions