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

Safari - [Error] SyntaxError: Invalid regular expression: missing terminating ] for character class #2625

Closed
joshikeerti opened this issue Sep 1, 2016 · 5 comments
Labels

Comments

@joshikeerti
Copy link

Hi,
I am using lodash version 4.15 in one of my projects and the below error is thrown in safari when the application is rendered for japanese language.

'Error] SyntaxError: Invalid regular expression: missing terminating ] for character class '

The error is thrown on this line in the source code
 var rsApos = "['\u2019]"

When the application is rendered in English, the source code shows  Yn = "['’]"
In Japanese its Yn = "['窶兢",

There is a bracket missing when its in japanese and the error is thrown.

@joshikeerti
Copy link
Author

joshikeerti commented Sep 1, 2016

Changing the source code to below fixed the issue.

var rsAposTemp = ''\u2019'
var rsApos = '[' + rsAposTemp + ']'

@jdalton jdalton added the invalid label Sep 1, 2016
@jdalton
Copy link
Member

jdalton commented Sep 1, 2016

Hi @joshikeerti!

This doesn't look like a Lodash issue. Maybe more an encoding issue?
I'm not sure how rendering would effect source code processing.

@jdalton jdalton closed this as completed Sep 1, 2016
@cbarbosa2
Copy link

I had a similar problem and it happened because I'm using WebPack's uglify which does the compression of unicode characters to UTF-8 and the server wasn't specifying UTF-8 as the charset causing the browser to fail to properly parse it.

@ndfhsledk
Copy link

ndfhsledk commented Sep 11, 2018

Did you forget to set charset in <head>?
If the answer is Yes, add <meta charset="utf-8"/> to <head>.

@lock
Copy link

lock bot commented Sep 11, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

4 participants