1

How to enable users to type Unicode characters in a web application? More specific, my users need to type the Dutch IJ and ij (Unicode: IJ and ij).

So I read Wikipedia and related sources, to find out it is perfectly fine to type those characters in Microsoft Word and Wordpad using ALT codes 0306 and 0307. In notepad however I get 2 and 3 instead. I was thinking this had something to do with simple notepad not being able to cope with multibyte encodings. But even Firefox 58 and Internet Explorer show 2 and 3 instead of the Unicode characters, when the webpage has Unicode enabled and <html lang="nl"> set. The page is rendered with the "Arial MS Unicode" font just like Word, to be sure that as much as possible Unicode characters are displayed correctly. My test machine runs Windows 8.1 with Internet Explorer set to Dutch, with also a Dutch version of Firefox.

So now users copy and paste from Word and Wordpad to their browsers which is pretty cumbersome. And obviously this method does not work on most computers (laptops, mobile phones) nowadays, because they don't have a numeric pad on their keyboard.

Others have similar issues. There is even a pragmatic tool to work around the problem.

It appears that typing ALT codes with a leading 0 has worked in the past on Windows XP and 2003, but setting a registry value for this to work on all clients is not an acceptable solution.

Isn't there a common solution to this human to browser barrier? Some JS API perhaps?

Code4R7
  • 2,600
  • 1
  • 19
  • 42
  • 1
    I’d say you’re probably best off to present users with some buttons in your editor UI, so that they can easily copy those “special” characters, resp. maybe even have them inserted at the current cursor position automatically - that would eliminate any need to remember the correct key combinations or OS trouble. (Asking for specific script recommendations would be off-topic here; but how inserting characters at the current cursor position works is something that should be easy enough to research.) – CBroe Feb 14 '18 at 09:56
  • That is very specific to the OS… Perhaps the IME editor/keyboard allows to easily enter such characters, perhaps long-pressing a key allows to select variations of it, perhaps the user has a dedicated key for ij on their keyboard, perhaps there's a simple character picker, perhaps autocorrect will do it for the user… That's not really your issue as a website owner to worry about, but if you really want to, provide a button to insert those characters. – deceze Feb 14 '18 at 10:01

0 Answers0