±Û¾´ÀÌ :ÃÖÀ翵 1998³â 7¿ù 22ÀÏ 17:45:01
In Reply to: ¾î¶»°Ô ÇÏ¸é ¼ºí¸´¿¡¼ ÇѱÛÀ» Á¦´ë·Î ¹ÞÀ» ¼ö ÀÖÀ»±î¿ä? posted by xsuk on 1998³â 7¿ù 22ÀÏ 08:50:50:
ÀÌ °Ô½ÃÆÇÀ» °Ë»öÇؼ ¾òÀº ÀÚ·á Áß¿¡ ´ÙÀ½°ú °°Àº ¸Þ¼Òµå°¡ ÀÖ´õ±º¿ä.
Àúµµ È®½ÇÈ÷´Â °¨À» ¸ø ÀâÀº °ü°è·Î ¼³¸íÀº ¸ø µå¸®°Ú°í ´ÜÁö Âü°íÇϽðí,
¿½ÉÈ÷ ¿¬±¸ÇØ º¸¼¼¿ä...
xsuk´ÔÀÇ °æ¿ì´Â convert_to_ksc()¸¦ »ç¿ëÇؼ ½ºÆ®¸µÀ» ¹Þ¾Æ ¿À¸é µÇ°Ú±º¿ä.
¹Ý´ë·Î ½ºÆ®¸µÀ» Ãâ·ÂÇÏ°íÀÚ ÇÒ °æ¿ì¿¡´Â convert_to_ascii()¸¦ »ç¿ëÇÏ¸é µË´Ï´Ù.
private String convert_to_ksc(String str) {
String result = null;
try {
byte[] rawBytes = str.getBytes("8859_1");
result = new String(rawBytes, "KSC5601");
} catch(UnsupportedEncodingException e) {
System.err.println(e.toString());
}
return result;
}
// ¿ì¸®°¡ »ç¿ëÇÏ´Â ½ºÆ®¸µÀÌ µðÆúÆ®·Î KSC5601·Î ÀÎÄÚµùµÇ¾î ÀÖÀ¸¹Ç·Î À¯´ÏÄÚµå·Î
// ÀÎÄÚµùµÈ us-ascii ½ºÆ®¸µÀ¸·Î º¯È¯Çؼ º¸³»¾ß ÇÑ´Ù. (À§´Â ¹Ý´ë·Î)
private String convert_to_ascii(String str) {
String result = null;
try {
byte[] kscBytes = str.getBytes("KSC5601");
result = new String(kscBytes, "8859_1");
} catch(UnsupportedEncodingException e) {
System.err.println(e.toString());
}
return result;
}