Bill Page wrote:
>
> On 4 April 2014 23:25, Waldek Hebisch <[email protected]> wrote:
>
> > Also, you use directly character codes inside the file. This
> > may look nicer, but will cause build problems on some
> > systems. Better use numeric codes. Also, FriCAS has
> > 'ucodeToString' function to produce Unicode String from
> > a single Unicode charater code. It is supposed to work
> > even if underlying Lisp does not support Unicode
> > (in such case it will produce multibyte string containing
> > Utf-8 encoding of the character). So, use 'ucodeToString'
> > and numeric codes in the table.
> >
>
> OK, I can use numeric codes in the table. Is it ok to include uft-8
> characters in spad comments?
Sorry, no. Sbcl (and probably other Lisps) will signal error
if there is unrecognized character anywhere inside spad file.
To recognize character appropiate locale must be installed
and active during build. Which locale are installed is user
choice -- the only locale which is always present is C
locale. The effect is that we can not assume anything
beyond 7-bit ASCII.
> Concerning ucodeToString: I am not so clear on the purpose. Do you
> mean use this function to convert to string instead of coercion? E.g.
>
> + cork: Character -> S
> ...
> cork(x) ==
> for i in Cork repeat
> if i.unicode.1 = x then return i.corkcode
> - x::String
> + ucodeToString x
>
> utf2cork str ==
> concat [cork i for i in entries str]
Oops, what I wrote makes no sense. The problem is that ecl
(and probably sbcl) may be build without Unicode support.
AFAIK gcl does not support Unicode at all. You can still
use Utf-8 with them, simply characters beyond ASCII will
be represented by multibyte strings. It would be nice
if utf2cork worked in such case. AFAICS we need a function
which given a Utf-8 string produces list of Unicode
characters (or more precisely Unicode code points)
contained in it. It is easy to make one, I hope to
do it today. I think that reasonable name for such
function would be 'uentries'. So you do not need 'ucodeToString'
(which works in opposite direction to what you need),
but should call 'uentries' instead of 'entries' inside
'utf2cork'.
--
Waldek Hebisch
[email protected]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.