My project is an emoticon keyboard, where each button (in a matrix) prints a different emoticon such as "( ・◇・)?"
I've read about the feasability of printing a unicode/UTF-8 string and it seems like the default serial reader does not accept unicode characters, only ANSII. I need to be able to print any unicode character (inside of a string) like you would with a normal keyboard.
I'm good with wiring and such, I just need to know:
Would a board like the Teensy work?
Would I need to make a custom driver on the PC in question to successfully print unicode?
Maybe you can connect it to processing, by using processing's serial communication to read your buttons, then pop up custom text or graphics of your unicode characters on screen.
Why do you need Unicode ?
When you type the text "( ・◇・)?", then you are typing UTF-8.
The Arduino doesn't know if ASCII, extended ASCII, UTF-8, UTF-16 or Unicode is used. It can handle bytes, and that's all.
The Arduino IDE itself uses UTF-8, that means you can send that text to the computer via a Serial port.
The 'serial monitor' of the Arduino IDE is not fully UTF-8 yet. It is almost UTF-8 in linux, but it is not UTF-8 in Windows yet.
When you use a Leonardo (or other ATmega32U4 board), then you have to find the keystrokes that makes that text.
Koepel:
Why do you need Unicode ?
When you type the text "( ・◇・)?", then you are typing UTF-8.
The Arduino doesn't know if ASCII, extended ASCII, UTF-8, UTF-16 or Unicode is used. It can handle bytes, and that's all.
The Arduino IDE itself uses UTF-8, that means you can send that text to the computer via a Serial port.
The 'serial monitor' of the Arduino IDE is not fully UTF-8 yet. It is almost UTF-8 in linux, but it is not UTF-8 in Windows yet.
When you use a Leonardo (or other ATmega32U4 board), then you have to find the keystrokes that makes that text.
So, Is there a way I can replace the arduino IDE so it can support UTF-8? (Sounds complicated) And what do you mean by finding the keystrokes? A lot of characters I use don't use alt codes it seems.
xxmamakinxx:
Maybe you can connect it to processing, by using processing's serial communication to read your buttons, then pop up custom text or graphics of your unicode characters on screen.
I'm trying to type a string onto a generic computer like a keyboard would.
Keyboards send scan codes, not ASCII or Unicode. You have to specify to which program you are sending input (keyboard driver?), then you know what information should be sent for your purpose.
Koepel:
Why do you need Unicode ?
When you type the text "( ・◇・)?", then you are typing UTF-8.
Unicode is a character set that defines some hundred thousand characters. UTF-8 and UTF-16 (as well as UTF-32 and a few others) are methods to encode Unicode characters to bytes. (Microsoft misnames their use of UTF-16LE as "Unicode", but don't be fooled by Microsoft doublespeak.) You can't read a file or any other byte stream as "Unicode" without knowing how it's encoded. In many cases it's UTF-8 (because ASCII characters are valid UTF-8), but in Windows land you'll often find UTF-16LE.
The 'serial monitor' of the Arduino IDE is not fully UTF-8 yet. It is almost UTF-8 in linux, but it is not UTF-8 in Windows yet.
I haven't used the Arduino serial monitor in Linux for awhile (there are much better serial terminals available in Linux land), but I believe in Windows it uses Windows-1252 or ISO 8859-1, both of which are only 8-bit encodings. But it's still not clear whether that's relevant to the OP's question.
It makes a difference whether characters are sent to a program, using e.g. serial transmission, or to a keyboard handler. A program will implement its own interpretation of the received bytes, as ASCII (SBCS) or UTF (MBCS). In this case the sender has to provide the characters as expected by that program.
A keyboard handler instead expects to receive keyboard scan codes, which it will compose into Unicode characters. Multiple scan codes may be required for a single Unicode character, like numeric keys while the ALT key is held down; this is how any Unicode character can be generated by a standard keyboard handler. Also SHIFT or CTRL modifiers affect the character created from any key. In this case the sender has to provide key up and key down messages, and leave it to the keyboard handler to translate these messages into characters.
@DrDiettrich I would like to use usb as it seems it would be simpler...
Also I am still confused as to whether or not I can use default keyboard properties to make UTF-8/unicode/whatever characters. All I could find was alt codes for a limited set of characters. Are there shortcuts for all characters?
As a reminder this should work like a generic keyboard-- except it prints UTF-8 strings instead of letters.
I think that your project extends into several Windows areas. You may also need a keyboard hook to catch certain characters and convert them into a different string. Or you use an editor with macro capabilities, which you can configure to translate certain codes into text snippets. Better ask in a Windows group, how you can achieve what you want. The procedures again are different for Linux, Android or other OS.