ÀÚ¹Ù 1.1


[ Follow Ups ] [ Post Followup ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

Posted by À±°æ±¸ on February 25, 1997 at 16:00:25:

In Reply to: ÀÚ¹Ù ÇѱÛÁö¿ø ¿©ºÎ posted by ¹ÚÁø±Ô on February 25, 1997 at 10:15:07:

ÀÚ¹Ù 1.1 ¹öÀüÀÌ ÇѱÛÀ» °ÅÀÇ Á¦´ë·Î Áö¿øÇÕ´Ï´Ù.
´ÙÀ½Àº °ü·ÃµÈ ±ÛµéÀÔ´Ï´Ù.
±Û 1 (from news:han.comp.hangul)
-------------------------------

native2asciiÀÇ document¿¡´Â ºüÁ® ÀÖÁö¸¸, 
`native2ascii -encoding KSC5601'À̶ó°í ¼öÇàÇϸé, Unicode-encoded ascii
file·Î conversionÇØ ÁÖ´õ±º¿ä.
¶ÇÇÑ, ´Ù¸¥ ¹®¼­¿¡¼­´Â jdk1.1ÀÌ KSC5601 code¸¦ Áö¿øÇÑ´Ù°í µÇ¾î ÀÖ½À´Ï´Ù.

Âü°í·Î, Çѱ۷ΠÀÛ¼ºÇÑ java source code (Áï, ÇÑ±Û º¯¼ö, ÇÑ±Û stringµîÀ» »ç¿ëÇÑ)
¸¦ ÀÌ¿Í°°ÀÌ Unicode-encoded ascii file·Î conversionÇؼ­ compileÇÒ ¼ö ÀÖ½À´Ï´Ù.

Hwin95¿¡¼­´Â (Solaris¿¡¼­´Â LANG º¯¼ö°¡ ko·Î settingµÇ¾î ÀÖ´Â °æ¿ì)
java compiler°¡ source code¸¦ KSC5601¹®¼­·Î ÀνÄÇؼ­ ÄÚµå º¯È¯ ÈÄ 
compileÇØÁֹǷÎ, native2ascii´Â ±×´ÙÁö Çʿ伺ÀÌ ³ôÁö´Â ¾Ê½À´Ï´Ù.

TextField, ÀÔÃâ·Â classµî ¿©·¯ class¿¡¼­µµ KSC5601 codeÀÇ ÀÔ·Â,
Unicode¿ÍÀÇ code º¯È¯µîÀÌ ¼öÇàµË´Ï´Ù.

ÇöÀç, Á¦°¡ testÇØ º» ¹Ù·Î´Â Unicode·ÎºÎÅÍ KSC5601 code·Î º¯È¯Àº
¹®Á¦°¡ ¾ø´Â °ÍÀ¸·Î º¸À̳ª, KSC5601 code·ÎºÎÅÍ Unicode·ÎÀÇ º¯È¯Àº
¾à°£ÀÇ bug°¡ ÀÖ½À´Ï´Ù. ÀÌ º¯È¯À» ´ã´çÇÏ´Â class°¡
sun.io.ByteToCharKSC5601Àε¥, ÀÌ classÀÇ bug¸¸ °íÄ¡¸é, ÇÑ±Û code º¯È¯°ú
°ü·ÃµÈ ¹®Á¦´Â °ÅÀÇ ¸ðµÎ ÇØ°áµÇ¸®¶ó »ý°¢µË´Ï´Ù.

ÀÌ class¿¡¼­ ÇöÀç Á¦°¡ ¹ß°ßÇÑ bug´Â º¯È¯ÇÒ KSC5601 ¹®¼­¿¡¼­ 
Áß°£ Áß°£¿¡ ¹®ÀÚ¸¦ »©¸Ô°í codeº¯È¯À» ÇÑ´Ù´Â °ÍÀÔ´Ï´Ù.
ÇÏÁö¸¸, ¿©·¯¹ø¿¡ °ÉÃļ­ code º¯È¯À» ÇÏ´Â °ÍÀÌ ¾Æ´Ï¶ó,
ÇѲ¨¹ø¿¡ code º¯È¯À» ÇÏ´Â °æ¿ì¿¡´Â ÀÌ·¯ÇÑ bug°¡ »ý±âÁö ¾Ê½À´Ï´Ù.

¿¹¸¦ µé¾î,
native2ascii´Â ÇѲ¨¹ø¿¡ codeº¯È¯À» Çϱ⶧¹®ÀÎÁö bug°¡ ¹ß°ßµÇÁö ¾Ê¾Ò½À´Ï´Ù.
±âŸ, ÇÑ±Û ¹®¼­¸¦ ÀоîµéÀÏ ¶§¿¡µµ BufferedReaderµîÀ» ¾Õ¿¡ ºÙ¿©¼­
Çѹø¿¡ codeº¯È¯ÀÌ µÇµµ·Ï ÇØÁÖ¸é Àß µ¿ÀÛÇÒ °ÍÀÔ´Ï´Ù.

¿¹: Reader in = new BufferedReader(new FileReader("doc.ks"))

Sun¿¡¼­´Â bug report¸¦ ¹Þ¾Æ¼­ jdk1.1ÀÇ bug¸¦ °íÄ£ jdk1.11À» 
Á¶¸¸°£ ¹ßÇ¥ÇÒ °ÍÀ̶ó°í ÇÏ´Ï, ¿©±â¿¡ ±â´ëÇØ º¾´Ï´Ù.

--
±è ´öÅ (dtkim@camars.kaist.ac.kr)
KAIST CS Dept. CA Lab

±Û 2 (from news:han.comp.hangul)
-------------------------------

> 
> Yoon Kyung Koo wrote:
> >
> > I tested JDK 1.1 final release on Hangul Windows NT 4.0 (Workstaion
> > version).
> > First, TextArea and TextField works on input and display but have some
> > problems...
> > When these TextComponents get hangul input including space (or
> > punctuation marks) they added '?' after space (or punctuation marks)
> > occasionally.
> 
> I don't know why those components generate such garbage key events.
> However, if you remove those bad events as follows,
> the problem can be solved.
> 
> ---------------------------
> import java.awt.*;
> import java.awt.event.*;
> 
> class TextAreaTest extends Frame
> {   TextArea ta = new TextArea();
>     {   add(ta, "Center");
>     }
>     public static void main(String[] args)
>     {   TextAreaTest f = new TextAreaTest();
>         f.ta.addKeyListener(new KeyAdapter()
>         {   public void keyTyped(KeyEvent ev)
>             {   if (ev.getKeyCode() == 0
>                     && ev.getKeyChar() == '?')
>                     ev.consume();
>             }
>         });
>         f.setSize(300, 300);
>         f.setVisible(true);
>     }
> }
> ---------------
> 
> > And I couldn't get args's correct value for Hangul in main methods.
> > This can be my fault. I am confused about the string value of args[]
> > in main method. Are the string value of args[] converted unicode value
> > of localized input, aren't they?
> > Could anybody tell me how I can handle hangul characters as args of
> > main method?
> 
> In Solaris, if LANG variable is set to "ko"
> java interpreter treat argument as KSC5601 code.
> But in Hangul Windows 95, it treat argument as ISO8859-1
> 
> This problem can be solved as follows.
> String class provide constructors and methods for code conversion.
> You can get original bytes of the argument by converting argument string
> to ISO8859-1 bytes.
> And then, you can convert the original bytes to Unicode using
> KSC5601-to-Unicode conversion
> 
> ------------------------
> class ArgTest
> {   public static void main(String[] args)
>         throws java.io.UnsupportedEncodingException
>     {   System.out.println(args[0]);
> 
>         byte[] rawBytes = args[0].getBytes("8859_1");
>         String correctedString = new String(rawBytes, "KSC5601");
>         System.out.println(correctedString);
>     }
> }
> ------------------------
> 
> --
> Deogtae Kim (±è´öÅÂ)
> CA Lab. CS Dept. KAIST
> E-Mail : dtkim@camars.kaist.ac.kr
> Phone  : +82-42-869-3569
> Fax    : +82-42-869-3510
Yoon Kyung Koo wrote:
> 
> I tested JDK 1.1 final release on Hangul Windows NT 4.0 (Workstaion
> version).
> First, TextArea and TextField works on input and display but have some
> problems...
> When these TextComponents get hangul input including space (or
> punctuation marks) they added '?' after space (or punctuation marks)
> occasionally.

I don't know why those components generate such garbage key events.
However, if you remove those bad events as follows, 
the problem can be solved. 

---------------------------
import java.awt.*;
import java.awt.event.*;

class TextAreaTest extends Frame
{   TextArea ta = new TextArea();
    {   add(ta, "Center");
    }
    public static void main(String[] args)
    {   TextAreaTest f = new TextAreaTest();
        f.ta.addKeyListener(new KeyAdapter()
        {   public void keyTyped(KeyEvent ev)
            {   if (ev.getKeyCode() == 0
                    && ev.getKeyChar() == '?')
                    ev.consume();
            }
        });
        f.setSize(300, 300);
        f.setVisible(true);
    }
}
---------------

> And I couldn't get args's correct value for Hangul in main methods.
> This can be my fault. I am confused about the string value of args[]
> in main method. Are the string value of args[] converted unicode value
> of localized input, aren't they?
> Could anybody tell me how I can handle hangul characters as args of
> main method?

In Solaris, if LANG variable is set to "ko"
java interpreter treat argument as KSC5601 code.
But in Hangul Windows 95, it treat argument as ISO8859-1

This problem can be solved as follows.
String class provide constructors and methods for code conversion.
You can get original bytes of the argument by converting argument string
to ISO8859-1 bytes.
And then, you can convert the original bytes to Unicode using
KSC5601-to-Unicode conversion


------------------------
class ArgTest
{   public static void main(String[] args)
        throws java.io.UnsupportedEncodingException
    {   System.out.println(args[0]); 

        byte[] rawBytes = args[0].getBytes("8859_1");
        String correctedString = new String(rawBytes, "KSC5601");
        System.out.println(correctedString);
    }
}
------------------------

-- 
Deogtae Kim (±è´öÅÂ)
CA Lab. CS Dept. KAIST
E-Mail : dtkim@camars.kaist.ac.kr
Phone  : +82-42-869-3569
Fax    : +82-42-869-3510



Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]