Is the hyphen and apostrophe the same ASCII code in different languages?

I need to specify a regular expression to validate user input, which allows the user to enter a hyphen or apostrophe on Windows Desktop or Mac OS / X operating systems.

The user can configure for the following languages:

  • English
  • French
  • Spanish
  • Portuguese
  • Hawaiian

I don’t understand if I use the standard ASCII regular expression for hyphens and apostrophes (for example ['-]), whether in most cases it will capture hyphen or apostrophe keys entered by the user. I believe that my definition is pretty loose, since there are many different keyboard layouts, OS versions, and language definitions (e.g. fr_FR, ca_FR).

I checked the following resources and, as a rule, searched in google, but could not find anything special in that the ASCII code generated by a key with the extension or will always be ASCII code 45 and ASCII code 39.


NOTE. If you think this question is poorly worded, add a comment to help me improve it.

+4
source share
1 answer

You mix a couple of things:

, scancodes. DVORAK QWERTY Q, '. . , .

blank key happy hacking keyboard

, , , - , .

, . , , , . , gettext, .

, . 2 : .

( ) , . -- , n-.

; , . ASCII, unicode, .

, : " ' -?". , , , . . . (dis) , .

+1

Source: https://habr.com/ru/post/1532989/


All Articles