±Û¾´ÀÌ :ÀüÀÀ½Ä 1998³â 3¿ù 02ÀÏ 11:13:14
In Reply to: ´õ ÀûÀýÇÑ ¹æ¹ý. posted by ±è´öÅ on 1998³â 2¿ù 27ÀÏ 11:41:35:
°á°ú°¡ ´À·Á¼ Á˼ÛÇÕ´Ï´Ù.
±×µ¿¾È ÀúÀÇ Oracle DB°¡ ³»·Á°¡¼ ÀÛ¾÷À» ¸øÇß´Ù°¡,
¿À´Ã DB°¡ ¿Ã¶ó¿Í¼ Test¸¦ ÇÏ¿´½À´Ï´Ù.
¸ÕÀú ³ªÁß¿¡ ¿Ã·ÁÁֽŠInputStreamÀÇ readChar() Method¸¦ »ç¿ëÇÏ¿©
Test¸¦ ÇÏ¿´´õ´Ï ÇѱÛÀÌ Á¦´ë·Î ³ª¿À´õ±º¿ä.
ÀÌ°Å¾ß ¸»·Î ÀåÀå1ÁÖÀÏ ¸¸ÀÇ ¼º°ú¶óÇÒ¼ö ÀÖ°ÔÁÒ.
¾ÕÀ¸·Îµµ Àú¿Í °°Àº °³¹ßȯ°æ¿¡¼ °³¹ßÀ» ÇϽŴٸé,
ÀÌ°÷¿¡ ¿Ã·ÁÁø ±ÛÀ» Âü°í·Î ÇÏ¿© °³¹ßÀ» ÇÏ¿´À¸¸é Çϳ׿ä..
ÇѱÛÀÌ Á¦´ë·Î ³ª¿Â ±â³äÀ¸·Î Á¦°¡ ±×µ¿¾È ¸ÂÇö´ø ºÎºÐ°ú
ÇØ°á¹æ¹ýÀ» Àû¾î³õÀ»·Á°í ÇÕ´Ï´Ù.
¿ì¼±
Oracle¿¡¼ Á¦°øµÇ¾îÁö´Â ¸Þ¼ÒµåÁß getStringÀº Çѱ۰ú °ü·ÃÇÏ¿©,
3:2ÀÇ ºñÀ²·Î ÀúÀåµÇ¾îÁø ÇѱÛÀ» °¡Áö°í ¿ÀÁö ¸øÇÏ°Ô µÇ¾îÀÖ´Â°Í °°½À´Ï´Ù.
¾Æ¸¶ getString MethodÀÇ ¹ö±×°¡ ¾Æ´ÒÁö.
±×·¡¼ ´Ù¸¥ Method¸¦ »ç¿ëÇÏ¼Å¾ß µÇ´Âµ¥ Àú´Â
StreamÀ» »ç¿ëÇÏ¿© °¡Á®¿Ô½À´Ï´Ù.
getUnicodeStreamÀ» »ç¿ëÇÏ¿© JDKÀÇ InputStream¿¡ ÀúÀåÇÏ°í,
ÀÌ°ÍÀ» ´Ù½Ã DataInputStreamÀ¸·Î »ý¼ºÇÏ¿© ÀÌ°ÍÀ» ´Ù½Ã readChar¸¦
(readChar·Î °¡Á®¿À½ÃÁö ¾ÊÀ¸¸é »óÀ§ ¹ÙÀÌÆ®¿¡ '00'°¡ ÀÔ·ÂÀÌ µÊ)
ÀÌ¿ë charÇüÀ¸·Î º¯È ´Ù½Ã StringÇüÀ¸·Î º¯È¯ÇÏ¿©,
ÇѱÛÀÌ Á¦´ë·Î Áö¿øµÇ°Ô ÇÏ¿´½À´Ï´Ù.
Âü°í·Î ÀúÀÇ Oracle DB ÀÇ LANG_SETÀº KSC5601·Î ¼ÂÆÃÀÌ µÇ¾îÀÖ½À´Ï´Ù.
¾ÕÀ¸·Î TESTÇÒ°ÍÀÌ ¸î°¡Áö ´õ Àִµ¥ ÃæºÐÈ÷ °¡´ÉÇϸ®¶ó »ý°¢µÇ¾îÁü´Ï´Ù.
<¼Ò½º>
InputStream input = results.getUnicodeStream(i) ;
DataInputStream pdataInputStream = new DataInputStream(input) ;
String str = "" ;
char testchar[] ;
int k=0, kk = 0 ;
if(input==null) System.out.println("input null") ;
try
{
testchar = new char[8] ;
for(kk = 0 ; kk<8 ; kk++)
testchar[kk] = pdataInputStream.readChar() ;
str = new String(testchar) ;
System.out.println(fromUni12(str)) ;
//À̺κÐÀº Äڵ尪À» º¸±â À§ÇØ ¸¸µç°ÍÀÓ..
for(int p=0;p<16;p++)
{
char c = str.charAt(p) ;
System.out.println(Integer.toHexString(c)+",") ;
}
}
¾ÕÀ¸·Î ±è´öÅ´ÔÀÇ ¸¹Àº ÀÚ¹®À» ºÎŹµå¸®¸ç
´Ù½Ã Çѹø ±×µ¿¾È ±è´öÅ´ÔÀÇ ÀÚ¹®¿¡ °¨»çµå¸³´Ï´Ù.