±Û¾´ÀÌ :ÀüÀÀ½Ä 1998³â 2¿ù 25ÀÏ 11:17:42
In Reply to: JdbcÀÇ getBinaryStream¿¡ °üÇÑ ÇѱÛÁú¹® posted by ÀüÀÀ½Ä on 1998³â 2¿ù 25ÀÏ 10:43:28:
Âü°í·Î Àú´Â serverÀÇ NLS-LANGÀº KO16KSC5601·Î
¼³Á¤ÇÏ¿©³õ¾Ò½À´Ï´Ù.
±×¸®°í getStringÇÏ¿© °¡Á®¿Â UNI1.2Äڵ带
¾Æ·¡ÀÇ ¼Ò½º¸¦ ÅëÇÏ¿© º¯È¯À» ÇÏ¿´´õ´Ï ÇѱÛÀº Á¦´ë·Î ³ª¿À´Âµ¥
±×¿ÜÀÇ ¹®ÀÚµé(¼ýÀÚ³ª, ½ºÆäÀ̽ºµî Ư¼öÅ°)Àº ±úÁ®¼
³ª¿É´Ï´Ù.
¾î¶»°Ô ÇÏ¿©¾ß µÇ´ÂÁö °¡¸£ÄÑÁֽñ⠹ٶø´Ï´Ù..
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 );
}