Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Re: Japanese Word processor for linux



Sam Joseph wrote:

> I am now porting to linux and I would love to be able to run the exact 
> same program, ideally with Shift_JIS characters - checking the code out 
> of Perforce onto my Linux box seems to leave the Shift_JIS characters 
> unreadable.  I was wondering if there was some kind of (ideally free) 
> japanese word processor for linux that would let me create files in 
> different japanese encoding formats like NJStar or JWPce do for windows.
> 
> It may of course be that I just need to set my Java environment on linux 
> correctly to allow me to compile the files - any suggestions very 
> gratefully received.

Java uses the LANG and LC_* environment variables to determine which
charset the source files are in.  So if you run java with
LC_CTYPE=ja_JP.SJIS it should work (in theory, I didn't try that).
Under linux the default for Japanese is euc-jp.

You can use the 'locale' tool to see what your apps will think about the
current environment.  The LC_CTYPE setting is responsible for the
expected character encoding.  However the locale tool only shows you the
name of the locale, not the character set used.
To find out the character set you can use the following program:

------------schnipp------------------
#include <locale.h>
#include <langinfo.h>

int main(int argc, char **argv)
{
	setlocale(LC_ALL, "");
	puts(nl_langinfo(CODESET));
	return 0;
}
------------schnapp------------------

You may have to add the locale (ja_JP.SJIS) to /etc/locale.gen and run
locale-gen to generate it.

ranma@example.com:~$ ./test
ISO-8859-1
ranma@example.com:~$ LC_CTYPE=ja_JP ./test
EUC-JP
ranma@example.com:~$ LC_CTYPE=ja_JP.SJIS ./test
ANSI_X3.4-1968
ranma@example.com:~$ su
Password: 
melchior:/home/ranma# echo ja_JP.SJIS SJIS >> /etc/locale.gen
melchior:/home/ranma# locale-gen
Generating locales...
  de_DE.ISO-8859-1... done
  de_DE.ISO-8859-15@example.com done
  de_DE.UTF-8... done
  en_IN.UTF-8... done
  en_US.ISO-8859-1... done
  en_US.UTF-8... done
  ja_JP.EUC-JP... done
  ja_JP.UTF-8... done
  ja_JP.SJIS...character map `SHIFT_JIS' is not ASCII compatible, locale not ISO C compliant
  done
Generation complete.
melchior:/home/ranma# exit
ranma@example.com:~$ LC_CTYPE=ja_JP ./test
EUC-JP
ranma@example.com:~$ LC_CTYPE=ja_JP.SJIS ./test
SHIFT_JIS

-- 
/* Tobias */     int main(int a,char **b)    /* PGP: http://9ac7e0bc.2ya.com */
{char i,j,t,*r=*++b;srand(getpid());for(;*r;){for(;*r&&!isalpha(*r);r++);for(i=
1;isalpha(r[i+1]);i++){j=rand()%i;t=r[i];r[i]=r[++j];r[j]=t;}r+=i+1;}puts(*b);}
np: Ziwtra: http://www.ocremix.org - Final Fantasy Adventure Willed Assault OC ReMix []


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links