UNICODE

A

Anarki

I would like to print a string in unicode. I compiled using gcc 3.4.4
in Cygwin(windows Xp). I used the following code. Gcc compiles it and
links but not giving the expected output, g++ don't even compile it,
it says wprintf is undeclared. I would also like to know why gcc
compiles it and g++ dosen't. someone please help me print a unicode
string using gcc or g++ in cygwin(windows xp)


#include <wchar.h>
int main()
{
wchar_t mal[] = L"ദീപàµâ€Œà´šà´¨àµà´¦àµâ€Œ പി";
wprintf(mal);
return 0;
}
 
M

Michael DOUBEZ

Anarki a écrit :
I would like to print a string in unicode. I compiled using gcc 3.4.4
in Cygwin(windows Xp). I used the following code. Gcc compiles it and
links but not giving the expected output, g++ don't even compile it,
it says wprintf is undeclared.

Use said:
I would also like to know why gcc
compiles it and g++ dosen't.

Without, the error message we can only guess (perhaps a conflict -
mbstate_t ?).
someone please help me print a unicode
string using gcc or g++ in cygwin(windows xp)

I assume your console is properly configured.

#include <cwchar>
#include <clocale> //for setlocale
#include <cstdlib> //for SUCCESS

int main()
{
wchar_t mal[] = L"ദീപàµâ€Œà´šà´¨àµà´¦àµâ€Œ പി";

std::setlocale( LC_ALL, "XXX" );//your language: Indian ?

std::wprintf(mal);
return EXIT_SUCCESS;
}
 
A

Anarki

Anarki a écrit :
I would like to print a string in unicode. I compiled using gcc 3.4.4
in Cygwin(windows Xp). I used the following code. Gcc compiles it and
links but not giving the expected output, g++ don't even compile it,
it says wprintf is undeclared.

Use said:
I would also like to know why gcc
compiles it and g++ dosen't.

Without, the error message we can only guess (perhaps a conflict -
mbstate_t ?).
someone please help me print a unicode
string using gcc or g++ in cygwin(windows xp)

I assume your console is properly configured.

#include <cwchar>
#include <clocale> //for setlocale
#include <cstdlib> //for SUCCESS

int main()
{
        wchar_t mal[] = L"ദീപàµâ€Œà´šà´¨àµà´¦àµâ€Œ പി";

std::setlocale( LC_ALL, "XXX" );//your language: Indian ?

        std::wprintf(mal);
        return EXIT_SUCCESS;

}

excuse me what u mean by properly configured console? I think i
haven't done any configuring can you please guide me am a novice in
configuring this cygwin all these days i was in visual studio, hope u
will help me and by the way the posted program didn't work :(. The
language i used was malayalam, language of Kerala/India.
 
M

Michael DOUBEZ

Anarki a écrit :
excuse me what u mean by properly configured console? I think i
haven't done any configuring can you please guide me am a novice in
configuring this cygwin all these days i was in visual studio,

I mean your console should be configured to display unicode.
echo "$LC_ALL"

Should tell you if you have the good locale.
hope u
will help me and by the way the posted program didn't work :(.

I guess you will find tutorial for your language somewhere on the web.
The
language i used was malayalam, language of Kerala/India.

#include <cwchar>
#include <clocale> //for setlocale
#include <cstdlib> //for SUCCESS

int main()
{
wchar_t mal[] = L"ദീപàµâ€Œà´šà´¨àµà´¦àµâ€Œ പി";

//loacale for malayalam is ml_IN
//if you use the UTF8 flavor, ml_IN.UTF8
std::setlocale( LC_ALL, "ml_IN" );

std::wprintf(mal);

return EXIT_SUCCESS;
}
 
J

James Kanze

Anarki a écrit :
I mean your console should be configured to display unicode.
echo "$LC_ALL"
Should tell you if you have the good locale.

Maybe. Something like "env | grep LC_" and perhaps echo "$LANG"
might be useful as well. However...

I'm not too sure how CygWin works here; with an xterm, what
counts is the font the console is using, and I wouldn't be
surprised if there aren't dependencies with regards to the font
and/or code page of the window as well.
 
M

Michael DOUBEZ

James Kanze a écrit :
Maybe. Something like "env | grep LC_" and perhaps echo "$LANG"
might be useful as well. However...

Yes $LANG would be better.
I'm not too sure how CygWin works here; with an xterm, what
counts is the font the console is using, and I wouldn't be
surprised if there aren't dependencies with regards to the font
and/or code page of the window as well.

It seems cygwin doesn't support unicode. So any out put is likely to be
garbage.

There is an UTF-8 cygwin:
http://www.okisoft.co.jp/esc/utf8-cygwin/

The OP should ask in a relevant group.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top