// euc to sjis converter by Murata // Usage: euc2sj [InputFile [OutputFile]] import java.io.*; class euc2sj { public static void main(String args[]) { InputStream fi = System.in; OutputStream fo = System.out; int ci, c[] = new int[2]; try{ if(args.length>0) fi = (InputStream)(new FileInputStream(args[0])); if(args.length>1) fo = (OutputStream)(new FileOutputStream(args[1])); while( (ci = fi.read()) != -1){ if((ci&0x80) == 0){ //if(ci != '\r') fo.write(ci); }else{ c[0] = ci; c[1] = fi.read(); euc2sj1(c); fo.write(c[0]); fo.write(c[1]); } } }catch(IOException e){ System.out.println(e.toString()); System.exit(1); }finally{ try{ fo.close(); fi.close(); }catch(IOException e){} } } static void euc2sj1(int c[]){ c[1] -= (c[0] & 1) == 0 ? 2 : (c[1] < 0xe0 ? 0x61 : 0x60); c[0] = (c[0] < 0xdf ? c[0] + 0x61 : c[0] + 0xe1) >> 1; } }