programming a foreign language

Journer

Banned
Jun 30, 2005
4,355
0
0
This may be way over my head as I haven only had 3 programming courses, but how can i get my program to read in/out Japanese?

So far all I've tried is a simple cout statement:

cout<<"???????????????<<endl;

and the compiler (visual studio 05) doesn't seem too like it. i am assuming there is something i have to include in order to get the program to output to the console in japanese since the native language is English. i googled and found nothing :'(
 

Tencntraze

Senior member
Aug 7, 2006
570
0
0
Are you sure that it's not displaying it correctly? You're outputting to the console window, which probably doesn't support those characters anyway. Try putting that text in a label on a form and it should show up.
 

Journer

Banned
Jun 30, 2005
4,355
0
0
Originally posted by: Tencntraze
Are you sure that it's not displaying it correctly? You're outputting to the console window, which probably doesn't support those characters anyway. Try putting that text in a label on a form and it should show up.

well this is what i did..

created a new empty console application
wrote the code, in the quotes i changed over to the MS IME input for japanese and type in what i wanted. then i switched back to english and finished up the code.

i dunno if MSdos supports japanese. cant tell if itll display correctly because it wont compile.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
What is the compilation error?

Until that is solved, there is no way it can be run in any environment.

No matter what the "display" language is, you are still reading in a character or word that is intended to represent a character. Your display system will need to be instructed on which "font" is to be used when you output a character.
 

Journer

Banned
Jun 30, 2005
4,355
0
0
well now it compiles, but with a lot of errors...here is the code:

#include <iostream>
using namespace std;
int main(){
cout<<"?????????????"<<endl;
return 0;}

asdf.cpp(4) : warning C4566: character represented by universal-character-name '\u306F' cannot be represented in the current code page (1252)

it does that for every character in the cout statement.

the console loads up and has just ? marks where the chars should be. well, now i know i have to tell it what font to use...how do i do that?
 

Journer

Banned
Jun 30, 2005
4,355
0
0
Originally posted by: aCynic2
I suspect your OS is not set up to display Kanji.

well its not just kanji, but it just japanese. however, my os is setup to view japanese as well as accept japanese input. i just think my console isnt setup right or like someone else said i need to tell the app what font to use.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Looking at the properties of the DOS box, there are only two fonts selectable.

You will have to either figure out how to make your special font availalbe to the DOS box or

Change the app to use a drawing window. then you can select the Font style using Windows SelectObject(CFont *) API


Looking through the MSDN Article, it implies that you have to have Fixed Pitch Fonts for DOS displays