Jump to content
  • Advertisement
Sign in to follow this  
Mizipzor

Non english characters in console?

This topic is 4777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Although the code, variables and comments are in english I want the output to be in swedish, e.i. I want non standard characters such as å ä ö to be able to be displayed. Is there any way to change this? Like switching unicode... or what is it called? Which number represents what character? Any kind of help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
The scandinavian char's are part of the standard ASCII table, so there shouldn't be any problem in outputting them, without having to mess with unicode (unless you want to of course [grin] ). To get the numbers google for "ascii table".

Share this post


Link to post
Share on other sites
Like the previous poster said, you can find codes for ÄÖÅäöå from ASCII table.

At the bottom of the page there is extended ASCII code table. Look codes for characters from it.

Following example might seem a bit weird (see comparisons) but it works just like it should. If someone knows easier way to do this, I would also like to know about it.


#include <iostream>
using namespace std;

int main()
{
char str[] = "ÄÖÅ characters and äöå are weird...";

cout << "Before: " << str << endl;

for (unsigned int i = 0; str != '\0'; i++) {
switch (str)
{
case 'Ä': str = (char)142; break;
case 'Ö': str = (char)153; break;
case 'Å': str = (char)143; break;
case 'ä': str = (char)132; break;
case 'ö': str = (char)148; break;
case 'å': str = (char)134; break;
}
}

cout << "After: " << str << endl;
return 0;
}






Edit: I assumed that you know C++ since you didn't mention the language. Oh and as far as I know, this conversion needs to be done when you are printing arrays that are declared in source files. If you read scandics from file I am quite sure that they don't need to be converted at all. If someone can confirm this, I would appreciate it.

Fruny - fixed link.

[Edited by - Fruny on June 18, 2005 12:49:49 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!