ASCII characters only validation in "Long free text"

7 months 4 weeks ago #161829 by kaz_k
kaz_k created the topic: ASCII characters only validation in "Long free text"
Hi, LimeSurvey all stars,

I want to restrict the input valid characters only to ASCII ones, ie. 0x20-0x7e.

I think it works for Short free text field (please refer Note below).

But I have difficulties for Long free text field.
I made a validation of "/^[\n\r !-~]+$/gis".
But It accepts Kanji (Japanese) characters. It seems that any restriction does not work.
(Please refer the attached screen copy. The bottom is the result.)

I consulted and found that "/^[\n\r !-~]+$/gis" seems to work. I could type statements of several lines with only ASCII characters with a match of the whole text. When I insert Kanji (Japanese) character, the whole input is invalid (not match).

Does anyone have an idea and/or help ?
Any comments welcome.

Note: I made a validation of "/^[ !-~]+$/" for Short free text field.
It works well.
Attached screen copy shows the results.
Topmost question and middle one have same validation definition of "/^[ !-~]+$/".
Kanji (Japanese) are input in the topmost question and it shows the input is inappropriate(red line and red message).
Only 0x20-0x7e characters are input in the middle question and it shows the input is appropriate(red line and red message).

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!