Reputation: 582
I am developing a web app and I want to use JSON objects with Unicode attributes such as the following:
a = {
ονομα:"hello"
}
And then use it like that
a.ονομα
Or maybe iterate over the object
I have tried it in the chrome console and it works fine but I would like to know if it is supported in other browsers and if it's a good practice.
Upvotes: 0
Views: 116
Reputation: 7474
Starting with JavaScript 1.5 a JavaScript identifier, you can use ISO 8859-1 or Unicode letters such as å and ü in identifiers. You can also use the \uXXXX Unicode escape sequences as characters in identifiers.
Looking at the browser compatibility for JS 1.5, you should be safe as even IE6-7 run that version.
For more detailed info check: http://mathiasbynens.be/notes/javascript-identifiers or this SO answer.
Upvotes: 3