If you can answer any of my questions, that would be awesome.
Here's the scoop: I'm teaching an intro to programming class in Thailand to 11th graders. It's been going great so far, their level of English is high enough that I can teach in English and have them write programs in English and everything is fine and dandy.
However, as speakers of a language with non-Latin characters, I feel that they should at least learn what UNICODE is. I won't test them on it or bog them down with implementation details, but I want to show them an example of a UNICODE program that can do I/O with Thai characters.
I'm operating under the following constraints, none of which can be changed (at least for this semester):
- The program must run on Windows 7
- The program must be in C (not C++)
- We must use Dev-C++ (v. 4.9.9.3) as our IDE (I'm going to try and convince the admins to change for next semester, but they may not want to)
- The program should output to the Command Line (I'd like it to "look like" the programs we've been writing so far)
- I want it to be easy to set up and run, though I'm not opposed to including a Batch file to do some setup work for the kids.
Here's how far I've gotten, and the questions I have:
- In Control Panel > Regions > Administrative > Language for non-UNICODE programs is set to Thai.
- I used "chcp 874" to set the Thai codepage in the Command Line, but characters from the keyboard come appear as garbage characters. Is this maybe because the keyboard mappings are wrong or do I have to change something else?
- I wrote a program with the line: printf("\u0E01\n"); which prints ก, the first letter in the Thai alphabet. Is that the right syntax?
- I received a compiler warning that "Universal Characters are only supported in C++ and C99." Does Dev-C++ not compile to C99? Is there a way I could get a C99 compiler for it?
- I ran the code and got garbage characters. I imagine this could be because of the compiler, the command line, or any number of other things.
I'd love to end this course with a program that outputs สวัสดีโลก, the Thai equivalent of "Hello World!" I've done tons of googling, but every answer I've found either doesn't work in this specific case or involved a different IDE.