I have a web page (charset = UTF-8) with multiple fields and a JavaScript client program. One specific input field must contain a number that is processed by the JavaScript function. It is assumed that the webpage will be used by the Japanese, in addition to German.
When the Japanese use the form, they are likely to use the Japanese input method to enter data. This means that in particular, a number such as "1" will be entered as "Japanese number 1", which is the Unicode character FULLWIDTH DIGIT ONE, that is% uFF11. I would like to turn such a number into a numeric value in JavaScript?
That is how far I have come. In this example, I focus only on the number 1, because if I can handle this, I can handle all the numbers:
The content of the input field is stored in my JavaScript variable moneystr. My idea is to replace each occurrence of the Japanese digit 1 with a βnormalβ digit 1. I found that I can do this, for example, as follows:
moneystr=moneystr.replace(/\uFF11/g,'1');
This seems to work well.
To extend this idea to all numbers, I can either write 10 such replacement operators, or write a loop from 0 to 9 and compute the unicode regular expression from the vaiable loop.
. ? Perl, tr, . JavaScript? ?