글쓴이 :전응식 1998년 2월 25일 13:30:21
In Reply to: 질문. posted by 김덕태 on 1998년 2월 25일 11:42:54:
먼저 관심을 가져주신것에 대해 감사를드리고,
대답이 느려 죄송합니다
Oracle 에는 '가나다 123 abc'로 입력을 하고 아래의
소스로 Test를 해보았습니다.
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);
System.out.println(String.valueOf(out)+","+Integer.toHexString(ksc[0])+","+Integer.toHexString(ksc[1])) ;
System.out.println(Integer.toHexString(String.valueOf(out).charAt(i))) ;
}
catch( java.io.UnsupportedEncodingException ex )
{ throw new InternalError( "Fatal Error: KSC5601 encoding is not supported." );
}
}
}
return new String( out );
}
그리하였더니 결과가 이렇게 나왔습니다.
가 ,ffffffb0,ffffffa1
ac00
가나 ,ffffffb3,ffffffaa
b098
가나다 ,ffffffb4,ffffffd9
b2e4
가나다# ,23,ffffff87
23
가나다## ,23,ffffff98
23
가나다### ,23,ffffff99
23
가나다#### ,23,ffffff9a
23
가나다##### ,23,ffffff87
23
가나다#####$ ,24,6a
24
가나다#####$$ ,24,6b
24
가나다#####$$$,24,6c
24
20String1= 가나다#####$$$