print chinese in console - Unix
This is a discussion on print chinese in console - Unix ; root $echo $LANG
zh.CN-utf8
root $ echo runlevel
3 3
root $ cat program
#include ........
int main (int argc, char **argv)
{
wchar_t *name = L"¤¤¤å";
setlocale (LC_ALL, "");
wprintf (L"%ls\n", name);
}
root $ ./program
??
>>>>>>>>>>>>>>>
my ...
-
print chinese in console
root $echo $LANG
zh.CN-utf8
root $ echo runlevel
3 3
root $ cat program
#include ........
int main (int argc, char **argv)
{
wchar_t *name = L"¤¤¤å";
setlocale (LC_ALL, "");
wprintf (L"%ls\n", name);
}
root $ ./program
??
>>>>>>>>>>>>>>>
my program can't print Chinese normal in console, but it is normal in
X.
i want to program to print warning message in Chinese normal, or
printing message in English. how can i do ??
THX
-
Re: print chinese in console
Xend writes:
> root $echo $LANG
> zh.CN-utf8
That looks odd. I'd have expected "zh_CN.UTF-8".
> root $ echo runlevel
> 3 3
Also odd. Are you showing us what is really happening or did you
re-type these lines?
> root $ cat program
> #include ........
> int main (int argc, char **argv)
> {
> wchar_t *name = L"ä¸*æ–‡";
> setlocale (LC_ALL, "");
> wprintf (L"%ls\n", name);
> }
Odd again. This is obviously not what you typed or saw (the program
should be a .c file). Because I am now not sure what is really in the
file, I can't help much. What is the output of
od -t c program.c
?
--
Ben.
-
Re: print chinese in console
On Oct 17, 7:41 pm, Ben Bacarisse wrote:
> Xend writes:
> > root $echo $LANG
> > zh.CN-utf8
>
> That looks odd. I'd have expected "zh_CN.UTF-8".
>
> > root $ echo runlevel
> > 3 3
>
> Also odd. Are you showing us what is really happening or did you
> re-type these lines?
>
> > root $ cat program
> > #include ........
> > int main (int argc, char **argv)
> > {
> > wchar_t *name = L"¤¤¤å";
> > setlocale (LC_ALL, "");
> > wprintf (L"%ls\n", name);
> > }
>
> Odd again. This is obviously not what you typed or saw (the program
> should be a .c file). Because I am now not sure what is really in the
> file, I can't help much. What is the output of
>
> od -t c program.c
>
> ?
>
> --
> Ben.
why can't the program display Chinese normal in console, but it's
normal in X.
-
Re: print chinese in console
Xend writes:
> On Oct 17, 7:41 pm, Ben Bacarisse wrote:
>> Xend writes:
>> > root $echo $LANG
>> > zh.CN-utf8
>>
>> That looks odd. I'd have expected "zh_CN.UTF-8".
>>
>> > root $ echo runlevel
>> > 3 3
>>
>> Also odd. Are you showing us what is really happening or did you
>> re-type these lines?
>>
>> > root $ cat program
>> > #include ........
>> > int main (int argc, char **argv)
>> > {
>> > wchar_t *name = L"ä¸*æ–‡";
>> > setlocale (LC_ALL, "");
>> > wprintf (L"%ls\n", name);
>> > }
>>
>> Odd again. This is obviously not what you typed or saw (the program
>> should be a .c file). Because I am now not sure what is really in the
>> file, I can't help much. What is the output of
>>
>> od -t c program.c
>>
>> ?
>>
>> --
>> Ben.
Best not to quote sig blocks. OK, mine is one line but even so it it
better to cut them out.
> why can't the program display Chinese normal in console, but it's
> normal in X.
It is impossible to say. My system has no trouble with the
characters you want to display and you have not answered any of the
points I raised so I have no more information now than I did
originally.
--
Ben.
-
Re: print chinese in console
Xend writes:
> why can't the program display Chinese normal in console, but it's
> normal in X.
It depends on your system. On some systems (especially those running on
x86 machines) the text display on the console. The software just tells
the hardware what character to display, rather than drawing the pixels
itself (often called "text mode"). The hardware then draws the
character using a pre-set font. This system is quite old and was
originally designed for English and European languages, so although it
is usually possible to make a new font, they are usually low resolution
and have a small number of possible characters (256 is common). Thus
they are not suitable for languages with a large number of detailed
characters.
There may be a way to use a "graphical console", where the software
draws the pixels. You'll have to ask someone with specific knowledge of
your operating system. Most likely it will be simpler just to use X, if
possible.