Sign in to follow this  

Foreign Symbols are getting mangled.

This topic is 4758 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

I am writing a little program for french class. I have a list of all these french verbs, and their english equivelent. So I randomly choose a french verb, then choose 5 english choices(one is correct) and display a multiple choice thingy to the user. The problem comes in when I use those foreign characters. I get these other weird symbols instead. I am using ascii, so what should I do? [Edited by - Sagar_Indurkhya on January 4, 2005 8:17:34 PM]

Share this post


Link to post
Share on other sites
#include <cwchar>, use wchar_t anywhere you'd use a char, and use the wide character equivalents of cout, cin, and std::string, they are wcout, wcin, and wstring, respectively. And quote all your strings with an L, like this: L"hello".

Share this post


Link to post
Share on other sites
getline is templated. It doesn't matter if you're using normal strings or wide ones:
std::wstring s;
std::getline(std::wcin, s);

Share this post


Link to post
Share on other sites
Yes I am. I do:

wcout << L"aménager";

and it prints out:

espΘrer

but in Visual studio, when debugging, I check the value of a string containing L"aménager", and it shows "aménager", so I am thinking this has something to do with command prompt doing it wrong. I use

_tmain()
{

}

Share this post


Link to post
Share on other sites
Weird. Running on an NT-based OS? I tried typing "echo aménager" at the command prompt and it answered me back with what I typed in, accent and all. Maybe the font on the command console differs from that of the IDE?

Share this post


Link to post
Share on other sites

This topic is 4758 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this