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

Data binding doesn't parse Japanese unicode characters #4723

Closed
ajiang286 opened this issue Jul 5, 2017 · 6 comments · Fixed by #4768
Closed

Data binding doesn't parse Japanese unicode characters #4723

ajiang286 opened this issue Jul 5, 2017 · 6 comments · Fixed by #4768

Comments

@ajiang286
Copy link

Version 1.6.1:

value="{{data.商品名}}"
evaluates to the string "{{data.商品名}}" instead of dereferencing data.商品名

@ajiang286
Copy link
Author

Seems to happen for any non-English/numeric unicode

@kevinpschaaf
Copy link
Member

The binding parser only considers valid javascript identifiers for path bindings.

However, as long as you don't need 2-way binding, you can use [[get('...')]] to retrieve paths using arbitrary characters by leveraging computed bindings and the get method that exists on the Polymer base class: http://jsbin.com/qucada/edit?html,output

If you need 2-way bindings to paths, you'll need to restrict the data model to valid JS identifiers.

Will one of those solutions work for you?

@ajiang286
Copy link
Author

I was able to come up with a solution based on your response. Thanks!

@TimvdLippe
Copy link
Contributor

Closing per above comment.

@arthurevans
Copy link

FYI, at least as of ES2015, I believe that the MDN article is wrong (or oversimplified) and that this is a valid JS identifier. The standard basically says that it should use one of the valid Unicode identifier characters:

https://www.ecma-international.org/ecma-262/6.0/index.html#sec-names-and-keywords

The related Unicode standard is here:

http://unicode.org/reports/tr31/

And if you look at the characters here, it appears that they're valid for identifiers. For example:

http://www.fileformat.info/info/unicode/char/5546/index.htm

And V8 don't seem to mind them at all:

image

@arthurevans arthurevans reopened this Sep 19, 2017
@TimvdLippe
Copy link
Contributor

Oh oops. After I closed this issue, I realized exactly the same, but did not reopen this issue. Thanks for doing so @arthurevans ! Note that I published #4768 that solves this particular issue as well 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants