Is possible to somehow write those special characters in DOS? (Sorry but i forgot the english name of them).
Because in portuguese we use it a lot.
Printable View
Is possible to somehow write those special characters in DOS? (Sorry but i forgot the english name of them).
Because in portuguese we use it a lot.
Well... ü is the ascii character 129. The others I believe are Unicode, unless I'm not seeing them on the ascii chart. Most of the accented vowels and consonants that appear in French and Spanish appear to be there, but for some reason some common ones from other languages (like for instance a with an acute) aren't there. If you want to print a character by it's ascii value, just cast the integer value.Oh, by the way... since 128 to 255 is extended, it may vary on different computers, so even with those a standard Unicode format is more acceptable, I think.Code:std::cout << (char)129;
The Extended ASCII set has all characters needed for the Portuguese language.
Just make sure your editor allows for ISO 8859-1 or ANSI 1252 Latin 1.
It is possible that an expression such as std::cout << "canção"; might fail at the console by displaying the wrong characters. If that is the case, then you must also have the console set for the correct codepage.
Ok, i'll search how to "correct" my console in google
In general I believe you should not use non-ANSI characters in string literals. You'd store the strings in a data file and read them from there.Quote:
Originally Posted by Mario F.
Though, keep in mind, you'll likely have to "fix" the consoles of any other computer that runs it too... that can be a pain on distribution. To be honest, I have no idea how to use a specific Unicode set in C++ as I'm from the US and our alphabet is adequately supported by ASCII. :)
You could always google it.
Google tells me how to make the console show acents characters, but i have no idea of how to config my msvs to use "ISO 8859-1 or ANSI 1252 Latin 1".
(Anyway the app is just for my pc :D)
In general it's compiler/OS-specific. In MS VC++/Win32 you can't even output Unicode with std::wcout, you need to call the WriteConsole() API function to output Unicode characters, EVEN if those characters exist in the default system codepage.Quote:
Originally Posted by SlyMaelstrom
> You could always google it.
It is still a pain to code for Unicode :(
It made me buy a book.
Hmm, I should write a book ;)Quote:
Originally Posted by Mario F.
I do think I'll post a Unicode tutorial on the Windows forum, though. I have quite a bit of experience working with it.
> Google tells me how to make the console show acents characters, but i have no idea of how to config my msvs to use "ISO 8859-1 or ANSI 1252 Latin 1".
It's somewhere on the editor options or somthing. Look around there for "codepage"... or "locale" maybe (doubt it).
But do remember that this is just so that you can actually see the portuguese characters in the editor. Chances are the editor is already configured for ANSI 1252. Cat advise meanwhile is easy to skip, but very important. Avoid string literals like the one I shown you. That was just an example to address another issue. Store them in files instead and load them at run time.
Darn! Do that, when you can :)Quote:
Originally Posted by Cat
I'm always surpised at the near lack of information regarding Unicode programming when you hear everywhere how important it should be. One of those inconsistencies roughtly scratching the "Do as I say, don't do as I do".
system("graftabl [xxx]") should allow you to change the codepage of your console. where [xxx] is replaced by the codepage number.
That sounds like a good idea to me. Or maybe even write an article/series of articles and maybe we can get some activity on the articles discussions boardQuote:
Originally Posted by Cat
*barf*Quote:
Originally Posted by King Mir