It depends on your applications, eg text processing with primitives such #
{ {. etc then unicode datatype is more convenient because 1 character = 1
atom. But J (and other languages) scripts source and many external
environments such as webpages, linux IO are using utf-8 (multiple byte
encoding) . So most likely you need to work with both data types and do
conversion when needed.
eg. convert to unicode to do some processing and then convert back to utf8

ca =: 'Hüte'

ca2 =: utf8 2#ucp ca

ca2

HHüüttee

#ca2

10




On Sat, Jan 30, 2021 at 6:53 PM Thomas Bulka <[email protected]>
wrote:

> 2021-01-30 08:58 GMT+01:00 "bill lam" <[email protected]>:
> > The ü is represented by 2 bytes although  it displays as a single
> characteron screen.
> > ca =: 'Hüte'
> >
> > #ca
> >
> > 5
> >
> > 1 2{ca
> >
> > ü
> >
> >
> > Alternatively you can convert it to unicode datatype
> >
> > 1 { ucp ca
> >
> > ü
>
> Hi Bill,
>
> thank you very much. This works as expected. Just one more question out of
> curiosity: Is there any reason not to work with unicode type character
> arrays in J? From a practical point of view it would be the preferred way
> to work with non-English textual data, wouldn't it?
>
> Kind regards,
>
> Thomas
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to