JShrink icon indicating copy to clipboard operation
JShrink copied to clipboard

"Unclosed string at position: 2955" error processing moment.js Hebrew locale configuration

Open acerix opened this issue 7 years ago • 2 comments

This examples causes an error "Unclosed string at position: 2955", referring to "יי" in the regex of the isPM function.

\JShrink\Minifier::minify(file_get_contents('https://raw.githubusercontent.com/moment/moment/develop/locale/he.js'));

I don't know any Hebrew, but as far as I can tell, the regex is valid.

acerix avatar Nov 04 '17 02:11 acerix

Here's a simplified example with part of the regex from the script that is causing an error:

\JShrink\Minifier::minify('/^(")$/');

acerix avatar Nov 07 '17 01:11 acerix

As far as I can tell, the problem is that JShrink processes scripts one byte at a time and therefore has problems with scripts containing multi-byte chars.

http://php.net/manual/en/book.mbstring.php

acerix avatar Nov 15 '17 21:11 acerix