|
From: | 이학성 |
Subject: | japanese print with printw fun ction on shift jis codeset |
Date: | Fri, 28 Oct 2011 14:41:12 +0900 |
Hello,
I'm trying to print japanese multi bytes character on shift-jis locale as below code.
First print was done well but second print displayed just a space character on terminal.
Accroding to the shift jis codeset pages, 0XFB 0xFC is effective character.
Either cat command or printf() function prints the character well.
I would be happy if you can show me the way to print it.
Thank you in advance.
#include <stdio.h>
#include <ncurses.h>
#include <locale.h>
int main()
{
int i;
char japan1[3] = { 0x8D, 0x82, 0x00 };
char japan2[3] = { 0xFB, 0xFC, 0x00 };
setlocale(LC_ALL,"");
initscr();
/* first print */
mvprintw( 0,0, "1:[%s]\n",japan1);
/* second print */
mvprintw( 0,1, "2:[%s]\n",japan2);
refresh();
getch();
endwin();
return 0;
}
I compiled the source with below command
$ cc japan.c -o japan -lncursesw
Following is my current environment.
- emulator : putty ( Character set translation: Use font encoding, Font: MS Gothic, Script: Japanese)
- termianl : xterm
- locale
LANG=ja_JP.shiftjis
LC_CTYPE="ja_JP.shiftjis"
LC_NUMERIC="ja_JP.shiftjis"
LC_TIME="ja_JP.shiftjis"
LC_COLLATE="ja_JP.shiftjis"
LC_MONETARY="ja_JP.shiftjis"
LC_MESSAGES="ja_JP.shiftjis"
LC_PAPER="ja_JP.shiftjis"
LC_NAME="ja_JP.shiftjis"
LC_ADDRESS="ja_JP.shiftjis"
LC_TELEPHONE="ja_JP.shiftjis"
LC_MEASUREMENT="ja_JP.shiftjis"
LC_IDENTIFICATION="ja_JP.shiftjis"
LC_ALL=
[Prev in Thread] | Current Thread | [Next in Thread] |