Question

A quick question regarding Angular Forms and Japanese characters. Am using Angular 1.2.17, and modern Chrome web browser on Mac OSX (latest).

Am writing an AngularJS application for Japanese market. Everything works great displaying Kana etc on the HTML pages etc. There are no issues with the web server, or Database etc, UTF8 support is throughout the application.

However, for the AngularJS forms, it does not read the Kanji / Hiragana / Katakana unless the word or sentence starts with latin character. Angular $scope appears to be unable to distinguish the fact that the JP characters have been typed at all unless prefixed with a latin character.

Example:

こにちわ does NOT register when typed into the input field, and hence form validation fails because it will think a required field is empty.

Whereas:

adsfこにちわ does register and the form can be submitted successfully. End to end, the JP characters are handled correctly, and get stored into DB correctly. So Angular / JS is parsing the UTF8 text correctly. The issue is likely something to do with how Angular binds to the data ($scope) when only JP characters are provided. It doesn't handle this properly by default.

Does anyone know of any HTML or Angular configuration etc - required Angular module or params, meta tags etc etc, that would coerce the Form to behave properly. Have not tested, but am pretty certain this issue is not specific to JP characters - it is likely anyone working with a non latin alphabet might have experienced the same behaviour.

Must be missing something obvious here.

Thank you for any help at all!

Was it helpful?

Solution

OK, updating this question very late - actually solved it very shortly after asking.

This turned out to be a timewaster question. Apologies.

But if anyone should come across a similar problem then please check for any REGEX declarations in the Form fields. For instance, a ng-pattern="/^[a-zA-Z]/"

Yes, this will do what it says, and exclude Kanji. Surprisingly it does NOT then put helpful validation error on the form field so from UI perspective it appears that the foreign language characters simply weren't registered.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top