test°á°úÀÔ´Ï´Ù.


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :ÀüÀÀ½Ä 1998³â 4¿ù 07ÀÏ 16:51:34

In Reply to: ¿ª½Ã, ³Ý½ºÄÉÀÌÇÁ JDK 1.1 ÆÐÄ¡¹®Á¦... posted by ±è´öÅ on 1998³â 4¿ù 07ÀÏ 13:36:22:

±×µ¿¾È ¾È³çÇϼ̴ÂÁö¿ä.


Àú¶§¹®¿¡ ¿©·¯ºÐµéÀÌ °í»ýÀ» ÇÏ½Ã´Â°Í °°¾Æ
Á˼ÛÇÕ´Ï´Ù.



¸ÕÀú 1¹ø° Á¦´ë·Î ¼ÂÆÃÀÌ µÇ¾îÀÖ°í¿ä
2¹ø°´Â ±×ÂÊ »çÀÌÆ®·Î µé¾î°¡´Ï ¸ðµç°ÍÀÌ ¶È°°ÀÌ
³ª¿Ô½À´Ï´Ù.


3¹ø°´Â ¾î¶»°Ô °Ë»ç¸¦ Çϴ°ÍÀÎÁö ¸ô¶ó¼­ ¾ÆÁ÷ °Ë»ç¸¦
¸øÇߺ¸¾Ò½À´Ï´Ù.


±×¸®°í jdk 1.1 ÆÐÄ¡¹öÀüÀ» NN¿¡ ±ò¾Æ test¸¦ ÇØ º¸¾ÒÀ¸³ª
°á°ú´Â °°¾Ò½À´Ï´Ù.


±×·¡¼­ ´Ù¸¥ PC¿¡¼­ ÀÛµ¿ÇÏ¿© º¸¾Ò´õ´Ï ¸¶Âù°¡Áö´õ±º¿ä..
¿Ö ÀÌ·± °á°ú°¡ ³ª¿Ã±î¿ä????????


±×·¡¼­ ¾Æ·¡¿¡ ÀúÀÇ ¾ÖÇø´ Ç®¼Ò½º¸¦ ¿Ã¸³´Ï´Ù.
ÀÌ ¼Ò½º´Â Á¦°¡ testÇغ¼·Á°í ¸¸µç ¼Ò½ºÀÔ´Ï´Ù.


±×¸®°í DB´Â ¿Ã¸®Áö ¸øÇÏ¿©¼­
°£´ÜÇÏ°Ô ¼³¸íÀ» µå¸±·Á°í ÇÕ´Ï´Ù.


ÀúÀÇ DB´Â OracleÀ» ¾²°í ÀÖÀ¸¸ç, DBÀÇ LANG SETINGÀº
KSC5602·Î µÇ¾îÀÖ½À´Ï´Ù.


±×¸®°í ¼­¹öÀÇ ¾ÖÇø®ÄÉÀ̼ÇÀº ´ÜÁö ¾ÖÇø´À¸·ÎºÎÅÍ
¿À´Â Query¸¦ ¹Þ¾Æ sqlnet port¸¦ ÅëÇØ DB¿¡ ÀÖ´Â
³»¿ëÀ» °¡Á®¿Í¼­ À̶§´Â uni1.2±×´ë·Î ¾ÖÇø´À¸·Î
¸®ÅÏÇÏ°Ô µÇ¾îÀÖ½À´Ï´Ù.


ÀÌ·¸°Ô ¿©·¯ºÐµé¿¡°Ô Æó¸¦ ³¢Ãĵ帮°Ô µÇ¼­ Á˼ÛÇÕ´Ï´Ù.


±×¸®°í ¾Æ·¡´Â ¾ÖÇø´¼Ò½ºÀÔ´Ï´Ù.



public class JDBCApp extends Applet
{
public static int socketportnum ;
static Socket server ;
public static InputStream net_input=null;
public static OutputStream net_output=null;
public static Convert gConvert = new Convert() ;
public String host = "111.11.1.1" ;
Panel pnlAdmin=new Panel();
TextArea gtextarea ;
TextField gtextfield;
String str = null ;
String sendQuery = "" ;
//////////////////////////////////////////////////////////////////////////////
public void init()
{
if( ! gConvert.toUni12("\uac00").equals("\u3400") ||
! gConvert.toUni12("\ud79d").equals("\u3d2d") ||
! gConvert.fromUni12("\u3400").equals("\uac00") ||
! gConvert.fromUni12("\u3d2d").equals("\ud79d")
){ System.out.println("Uni 1.2 - 2.0 fail ") ;
}
if ( ! gConvert.to8859_1( "a\uac00" ).equals( "a\u00b0\u00a1" ) ||
! gConvert.from8859_1( "a\u00b0\u00a1" ).equals( "a\uac00" ) )
System.out.println( "Conversions between KSC5601 range and 8859-1 range"+" in Unicode 2.0 failed." );
else
System.out.println( "Conversions between KSC5601 range and 8859-1 range"+" in Unicode 2.0 are O.K." );


socketportnum = Integer.parseInt(getParameter("SERVERPORT")) ;


setBackground(Color.white) ;
setLayout(new BorderLayout()) ;
pnlAdmin.setLayout(new BorderLayout());
pnlAdmin.reshape(1, 100, 600, 400);
pnlAdmin.setBackground(Color.white) ;


gtextarea = new TextArea(100,100) ;
gtextarea.reshape(30, 30, 600, 200);
pnlAdmin.add(gtextarea) ;


gtextarea.appendText("") ;
gtextfield = new TextField("select boa_text from etc_board where boa_id = '99975'^",50) ;///H=ascd^/JDBC select distinct adm_cid, adm_city from a1 order by adm_cid^
// select boa_text from etc_board where boa_id = '99975'^
gtextfield.reshape(30,0,300,25) ;
pnlAdmin.add(gtextfield) ;
add(pnlAdmin); //"Center",
// addNotify();
}
//////////////////////////////////////////////////////////////////////////////
public boolean keyDown(Event evt, int key)
{
if(key == 10)
{
sendQuery = gtextfield.getText() ;
System.out.println("portnum = "+String.valueOf(socketportnum)) ;
str = write_net_output(sendQuery, socketportnum) ;
gtextarea.appendText("fromUni12 = "+gConvert.fromUni12(str)) ; //ÇѱÛ..
gtextarea.appendText("8859_1Uni1 = "+gConvert.to8859_1(gConvert.fromUni12(str))) ; //¿µ¹®..
repaint() ;
System.out.println("sendQuery = "+sendQuery) ;
}
return super.keyDown(evt,key) ;
}
public void paint(Graphics g)
{
int y = 30 ;
if(str != null)
{
g.setColor(Color.black) ;
g.drawString(gConvert.fromUni12(str), 10, y) ;
y += 30 ;
g.drawString(gConvert.to8859_1(gConvert.fromUni12(str)), 10, y) ;
}
else System.out.println("str null") ;
}
public String write_net_output(String value, int portnum)
{
int i=value.length() ;
byte bt[]=new byte[i] ;
value.getBytes(0,i,bt,0) ;
try{
server = new Socket(host,portnum);
net_input = server.getInputStream();
net_output = server.getOutputStream ();
net_output.write(bt);
}catch (IOException e){
System.out.println("Commaction Error!") ;
}
String str = read_net_input() ;
return str ;
}
public String read_net_input()
{
DataInputStream pdataInputStream = new DataInputStream(net_input) ;
String ret=null ;
while(ret==null)
{
if(pdataInputStream == null)
System.out.println("pdataInputStream == null") ;
try{
char testchar[] = new char[10000] ;
for(int kk=0;;kk++)
{
testchar[kk] = pdataInputStream.readChar() ;
// System.out.println(Integer.toHexString(testchar[kk])) ;
if(testchar[kk] == '^')
{
System.out.println("^find Ok!") ;
break ;
}
}
ret = new String(new String(testchar)) ; //gConvert.fromUni12( )
}catch (IOException e){
System.out.println(String.valueOf(e)) ;
ret = null;
break ;
}
}
return ret ;
}
}



class Convert
{
public Convert (){}
public static String toUni12( String uni20 )
{
int len = uni20.length();
char[] out = new char[len];
for( int i = 0; i < len; i++ )
{
char c = uni20.charAt(i);
if ( c < 0xac00 || 0xd7a3 < c )
{
out[i] = c;
} else // À¯´ÏÄÚµå 2.0 ÇÑ±Û ¿µ¿ª
{
try
{
byte[] ksc = String.valueOf(c).getBytes("KSC5601");
if ( ksc.length != 2 )
{
out[i] = '\ufffd';
System.err.println("Warning: Some of Unicode 2.0 hangul character was ignored." );
} else
{
out[i] = (char) ( 0x3400 +
((ksc[0] & 0xff) - 0xb0) * 94 +
(ksc[1] & 0xff) - 0xa1 );
}
} catch( java.io.UnsupportedEncodingException ex )
{ throw new InternalError("Fatal Error: KSC5601 encoding is not supported." );
}
}
}
return new String( out );
}
// Unicode 1.2 -> Unicode 2.0
public static String fromUni12( String uni12 )
{
int len = uni12.length();
char[] out = new char[len];
byte[] ksc = new byte[2];
for( int i = 0; i < len; i++ )
{
char c = uni12.charAt(i);
if ( c < 0x3400 || 0x4dff < c )
{
out[i] = c;
} else if ( 0x3d2e <= c ) // À¯´ÏÄÚµå 1.2 ÇÑ±Û º¸Ãæ ¿µ¿ª A, B
{
System.err.println("Warning: Some of Unicode 1.2 hangul character was ignored." );
out[i] = '\ufffd';
} else // À¯´ÏÄÚµå 1.2ÀÇ KSC5601 ´ëÀÀ ÇÑ±Û ¿µ¿ª
{
try
{
ksc[0] = (byte) ( (c - 0x3400) / 94 + 0xb0 );
ksc[1] = (byte) ( (c - 0x3400) % 94 + 0xa1 );
out[i] = new String( ksc, "KSC5601" ).charAt(0);
} catch( java.io.UnsupportedEncodingException ex )
{ throw new InternalError(
"Fatal Error: KSC5601 encoding is not supported." );
}
}
}
return new String( out );
}
// KSC5601 range in Unicode 2.0 -> 8859_1 range in Unicode 2.0
public static String to8859_1( String ksc )
{
try
{
return new String( ksc.getBytes("KSC5601"), "8859_1" );
} catch( java.io.UnsupportedEncodingException ex )
{ throw new InternalError(
"Fatal Error: KSC5601 or 8859_1 encoding is not supported." );
}
}
// 8859_1 range in Unicode 2.0 -> KSC5601 range in Unicode 2.0
public static String from8859_1( String iso8859_1 )
{
try
{
return new String( iso8859_1.getBytes("8859_1"), "KSC5601" );
} catch( java.io.UnsupportedEncodingException ex )
{ throw new InternalError(
"Fatal Error: KSC5601 or 8859_1 encoding is not supported." );
}
}
}





´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]