Hi all,
thanks you for all advices.

Recently I've been trying to migrate some tools ,
which doesn't always need to install into local PC,
to Curl platform.

So, at first, for experiment, now I'm trying to make
a terminal emulater which will be combined with telnet
and ssh protocol.

As you see the bellow experimental detached applet,
I'm trying to make the keyboad inputs transformed from
unicode to shift-jis character.

Because most UNIX servers in Japan are using shift-jis or euc-jp
encoding, the client terminal must send the appropriate encoded
characters according to the server's encoding mode.

At this moment, in my plan, the method of sending encoded characters
from a curl cient terminal to a server will be done with converting
the default input character (it's unicode, which is curl's standard)
to the other encoded chdracter.

But with the bellow code, I can not even input multibyte characters
like "あ"(a Japanese character) from keyboad with Japanese IME
(Japanese Input Method program).
I wonder that maybe IME cannot be enabled.

Please tell me how to solve this problem or general usage rules of
Input Method in Curl platform.

-------------------------------------------------------------------
{curl 4.0 applet}
{curl-file-attributes character-encoding = "shift-jis"}

{import CURL.UTIL.ELASTIC}

{define-class public TestView {inherits View}

  field td:TextDisplay = {TextDisplay}

  {constructor public {default td:TextDisplay, ...}

    {construct-super input-method-enabled? = true, ...}

    set self.td = td

    {self.request-key-focus}
    set self.input-method-enabled? = true

    {self.add-event-handler
        {on e:KeyPress do
            {if e.normal? then
                let s:String ={String e.value}
                let byteVec:ByteVec = {ByteVec max-size=2}
                let char-encoding:CharEncoding =
{get-character-encoding-by-name  "shift-jis"}
                let (in:int,out:int)={encode-characters
                                         s,
                                         byteVec,
                                         char-encoding}

                let out-str:String = {format "%s (",s}

                {for i:int=1 to out do
                    set out-str = out-str & {format "0x%02x ", byteVec[i
- 1]}
                }
                set out-str = out-str & ")"
                set td.value = out-str
            }
        }
    }
  }
}

{let g-td:TextDisplay = {TextDisplay
                            width={make-elastic},
                            height={make-elastic},
                            font-size=24pt,
                            font-weight=FontWeight.bold,
                            font-family="MS ゴシック"
                        }
}

{TestView
    g-td,
    width = 15cm, height = 2cm,
    {Frame
        width = {make-elastic},
        height = {make-elastic},
        margin=8pt,
        g-td
    },
    visibility = "normal",
    {on WindowClose do
        {exit}
    }
}
----------------------------------------------------------------

regards.
--maekawa


*******************************************
To unsubscribe from this list, send a mail to:
mailto:[EMAIL PROTECTED]
To contact a human list administrator, send a mail to:
mailto:[EMAIL PROTECTED]
To recieve a list of other options for this list, send a mail to:
mailto:[EMAIL PROTECTED]

Reply via email to