Re: Unicode and Java TextAreas

From: Mark Davis (marked@best.com)
Date: Thu Apr 30 1998 - 03:12:30 EDT


TextAreas and TextFields are both implemented using the host equivalents, so the
Unicode text is mapped to the host character set (or whatever Java thinks that is),
resulting in a loss of data. Unfortunately, even where a Unicode code set is
supported by the host, such as on NT, the standard Java implementation picks a more
limited character set.

Moreover, the mapping between characters in the editable field and Unicode characters
is not well maintained, so setting the selection can produce incorrect results, for
example.

As in the note, the newer Swing/JFC JTextComponent (available by download from the
Sun java site) implements text editing in pure Java, and is not subject to these
limitations. I haven't really played around with it much, and so can't speak to its
features in general.

Mark Davis

Richard Kunst wrote:

> Back in February Glen Perkins and Leong Kok Yong wrote about being
> able to write and display the full Unicode character set on Canvases,
> in menus, on buttons, etc. What about TextAreas and TextFields?
>
> No matter what we do, any characters beyond the local code page of
> the machine are turned into characters in the local code page or
> replaced with ASCII question marks. Sun's Java Workshop seems to be
> capable of writing and displaying Unicode characters in what appears
> to be a TextArea in their IDE--don't know how they do it.
>
> Any suggestions?
>
> Rick Kunst
>
> On Tue, 3 Feb 1998 14:02:34 -0800 (PST) Glen Perkins
> <gperkins@netcom.com> wrote:
> >
> > Leong Kok Yong wrote:
> >
> > > You need to tweak your font.properties file to use a Unicode font and the
> > > font must contain the glyph for Hebrew. Also, you can draw it on Canvas
> > > but not a AWT widget like button or menu i think, correct me if i'm wrong.
> > >
> >
> > You're not wrong, but everyone doing i18n work in Java should be using the new
> > JFC ("swing") replacements for the old AWT components. I have no trouble using
> > mixed C, J, & K in menus, on buttons, etc. on a US Win95 machine. BiDi is coming
> > as part of the Java2D API, which will be part of the core in Java 1.2.
>
> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
> OIT Humanities Computing Facility Tel. (919) 660-3194
> 319 North Building - Box 90269 Fax: (919) 660-3191
> Duke University E-mail rkunst@duke.edu
> Durham, NC 27708 USA http://www.lang.duke.edu
> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/



This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:20:40 EDT