Computer Science Canada Displaying characters form Unicode. |
| Author: | HazySmoke)345 [ Wed Dec 27, 2006 2:23 am ] | ||
| Post subject: | Displaying characters form Unicode. | ||
Here's the problem: I am a grade 11 student, and the homework just piles up and up, and I consider myself a logical-thinking king of guy, so I hate language-related subjects, such as English or French. Since my teacher is lame, every now and then I have to type up my French project - in fact, she does not allow hand-written assignments. And it's really a pain to type in the accents, such as C with a hook under it, or E with a hat on top. So, whenever I have to type accents, I need to find a French website, find a word with these accents, and copy & paste them into my word document, and it takes a long long time. Therefore, I'm trying to make a program that reads in a plain text French document, and make the following conversions: Convert "/e" to the e with an acute accent. Convert "\e" to the e with a grave accent. Convert "^e" to the e with a hat on top. ... etc. So I started off by trying to make a program that prints out these special characters in the first place, and this is my code:
And when I opened the file, all I saw was a whole bunch of question marks. Why is that? |
|||
| Author: | HazySmoke)345 [ Wed Dec 27, 2006 2:25 am ] |
| Post subject: | |
Sorry about the double post, but the typo right there /really/ ticks me off. It's "kind of guy", not "king of guy". |
|
| Author: | Monstrosity_ [ Wed Dec 27, 2006 2:58 am ] | ||
| Post subject: | Re: Displaying characters form Unicode. | ||
HazySmoke)345 wrote: Since my teacher is lame, every now and then I have to type up my French project - in fact, she does not allow hand-written assignments. And it's really a pain to type in the accents, such as C with a hook under it, or E with a hat on top. So, whenever I have to type accents, I need to find a French website, find a word with these accents, and copy & paste them into my word document, and it takes a long long time. I believe only a-z A-Z and 0-9 can be used in a source file for porability reasons, your best bet is to follow that. HazySmoke)345 wrote: Therefore, I'm trying to make a program that reads in a plain text French document, and make the following conversions: Convert "/e" to the e with an acute accent. Convert "\e" to the e with a grave accent. Convert "^e" to the e with a hat on top. ... etc. So I started off by trying to make a program that prints out these special characters in the first place, and this is my code:
And when I opened the file, all I saw was a whole bunch of question marks. Why is that? You editor cannot wide characters, output to the console or get a better editor. Also, the character type can't guarantee you'll get those values. Look up the wide character type and assosiated functions. I personally havn't worked with them much, but good luck. |
|||
| Author: | haskell [ Wed Dec 27, 2006 11:59 am ] | ||
| Post subject: | |||
If you are on a Windows machine, you could always go:
Or set your keyboard to be of Canadian configuration, instead of American. And here may help you on your quest for a useful personal program |
|||
| Author: | HazySmoke)345 [ Wed Dec 27, 2006 2:23 pm ] |
| Post subject: | |
I tried to output it on the console... it still says a bunch of question marks. Yeah, character map is the place where I found the unicode values of these characters in the first place I tried to install the French keyboard when I was installing Windows XP, but it froze, and I did not dare try it again. But nevertheless, thanks guys, the link seems to be useful, but it's also kind of confusing French FTL (for the lose)!!! |
|
| Author: | OneOffDriveByPoster [ Wed Dec 27, 2006 4:04 pm ] |
| Post subject: | |
An alternative approach may be to use HTML entities like é. |
|
| Author: | bugzpodder [ Fri Dec 29, 2006 12:20 pm ] |
| Post subject: | |
use a unicode supported editor such as notepad2 or word, and go from there. |
|