The J tolower and toupper only work for ASCII and will likely to continue to do so as general unicode conversion is complicated.

Use host services for things like this. For example in Windows:

  unilower=: 'user32 CharLowerBuffW i *w i'
  d=.'aBc' , (u:39321 28207), 'E'
  >1{wlower cd d;#d
abc香港e


----- Original Message ----- From: "bill lam" <[EMAIL PROTECTED]>
To: "Beta forum" <[email protected]>
Sent: Thursday, September 07, 2006 1:13 AM
Subject: [Jbeta] tolower/toupper


tolower and toupper in stdlib is not unicode compatible. eg
  toupper 3 2$'aBc' , (u:39321 28207), 'E'
|index error: toupper
|       toupper 3 2$'aBc',(u:39321 28207),'E'

and it is not always possible to convert to utf8 for processing
  utf8 3 2 $ 'aBc' , (u:39321 28207), 'E'
|rank error: utf8
|       utf8 3 2$'aBc',(u:39321 28207),'E'

alternatively it might redefine them as

'l u'=. (a.i.'aA') +each <i.26
tolower0=: a.&i. { ((l{a.) u} a.)"_
toupper0=: a.&i. { ((u{a.) l} a.)"_
ascsub=: 1 : 0
msk=. (128 > 3&u:) y1=. ,y [ s=. $y
s $ (u msk#y1) (I.msk)}y1
)
tolower=: tolower0 ascsub
toupper=: toupper0 ascsub

  toupper 3 2$'aBc' , (u:39321 28207), 'E'
AB
C香
港E

--
regards,
bill
----------------------------------------------------------------------
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