Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printing international characters in a console window with cout

Posted on 2004-04-28
3
Medium Priority
?
543 Views
Last Modified: 2013-12-03
Hello,

I’m using Visual Studio 6.0 and XP. The layout of the keyboard is Azerty (Belgian-Dutch). The problem is this:

#include "stdafx.h"
#include <iostream.h>
void main()
{
    cout << "My name is Hélène\n";
}
//  output: My name is HÚlÞne

When I write this program, I get the wrong output on my console window, as you can see. Is it possible to use cout and get the correct output? It’s important, because here in Belgium we use a lot of accents.

This question is asked on a Dutch speaking forum but nobody seems to know an answer. The strange thing is that it works as expected with a compiler like gcc (Linux).

It’s possible to print all the ascii-characters with a program like this:

// Print extended ascii codes and characters
using namespace std;
#include <stdafx.h>
#include <stdio.h>

void main()
{
    for (int i = 128; i < 255; i++)  printf("ASCII character #%i = %c\n", i, i);
};

But this is a way to work around the problem, it doesn’t solve it. Of course, we have examined MSDN but with no success so far.

So, how can we use cout and cin, and get the correct characters in a console window?

Thx

0
Comment
Question by:pongping
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Expert Comment

by:George Tokas
ID: 10939087
Hello there.
First of all here is Borland's C++ Builder area..:-)
Anyway the problem you describe is located at the fonts used on terminal window.
Check out how you can change the font used at the terminal window on the startup of your application to display the right characters and restore it when terminating.

Regards,
gtokas.
0
 

Author Comment

by:pongping
ID: 10939435
I'm sorry, gtokas. Its my first time here, and I didn't realise that I was in the Borland section. Can this be moved to the right place, or must I ask my question again?

Thanks for your answer, but I don’t know how to change the font of the terminal window.
0
 
LVL 16

Accepted Solution

by:
George Tokas earned 375 total points
ID: 10939620
No Problem..:-)
Post a redirection to this page in C++ area with 0 points or ask a moderator to do this for you...:-)
Sorry I did't helped you much but first of all I'm using BCB and second never tried such a task in windows. I mean the console window...

gtokas.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question