Wednesday 15 August 2012

regex - spanish characters not coming properly in javascript? -


Hi, I am using the following regular expression. It works fine in jsfiddle.

  var string = "zñáéíóúü1111"; If (/ ^ [0- 9a-zñáéíóúü] + $ / i.test (string) $ $ ("# result"). Text ("oak with input"); } And {$ ("# result"). Text ("error"); }   

But when I put the code in the browser, the Spanish characters do not come (some strange characters) (see the source code in the browser). And the above mentioned regular expression is not working properly.

But I have

  & lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" />   

In the browser.

I'm not sure of the reason why I did not work on my page, when I'm getting input from the user. But I checked the warning and the characters in this string. Both are similar.

I have not saved your HTML or JS file or both as UTF-8 The editor should adjust the charset setting. Depending on the editor, you can find them in the dialog that they save or the properties of the files.

No comments:

Post a Comment