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 Char detection #48

Merged
merged 2 commits into from
Jul 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/JShrink/Minifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ protected function saveRegex()
*/
protected static function isAlphaNumeric($char)
{
return preg_match('/^[\w\$]$/', $char) === 1 || $char == '/';
return preg_match('/^[\w\$\pL]$/', $char) === 1 || $char == '/';
}

/**
Expand Down
11 changes: 11 additions & 0 deletions tests/Resources/jshrink/input/utf_chars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var π = Math.PI,
ε = 1e-6,
radians = π / 180,
degrees = 180 / π;

function sgn(x) {


var π = Math.PI;
return x > 0 ? 1 : x < 0 ? -1 : 0;
}
1 change: 1 addition & 0 deletions tests/Resources/jshrink/output/utf_chars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var π=Math.PI,ε=1e-6,radians=π/ 180,degrees=180 / π;function sgn(x){var π=Math.PI;return x>0?1:x<0?-1:0;}