Lisp HUG Maillist Archive

*standard-output* with Unicode characters?


I'm confused about how to output Unicode characters to
*standard-output* using format.  In my delivered app (and in my normal
development saved image) I want to do the equivalent of:

  (format t "~a~%" (string (code-char 8217)))

And have that print something (almost anything really) to the standard
output of my Linux terminal.

Instead, I get thrown into the debugger with "Error: #\U+2019 is not
of type BASE-CHAR." -- which is certainly true, since it's not an
8-bit character.

I'ved tried using SET-DEFAULT-CHARACTER-ELEMENT-TYPE and that didn't
seem to make a difference.  I presume I need to rebind
*standard-output* and/or *terminal-io* but I'm not sure how to do
that.

Any advice.

Cheers,
Chris Dean


Re: *standard-output* with Unicode characters?

Chris Dean wrote:
> I'm confused about how to output Unicode characters to
> *standard-output* using format.  In my delivered app (and in my normal
> development saved image) I want to do the equivalent of:
> 
>  (format t "~a~%" (string (code-char 8217)))

This works fine for me in LW 4.4.6.

I see:

REPL> (format t "~a~%" (string (code-char 8217)))
-- > '
--> NIL

Mitch


Re: *standard-output* with Unicode characters?


"Mitch Berkson" <mitch@bermita.com> writes:
> This works fine for me in LW 4.4.6.
>
> I see:
>
> REPL> (format t "~a~%" (string (code-char 8217)))
> -- > '
> --> NIL

I only have LW 5.0 around these days, but that's good to know that the
older version works differently.

I get the same behavior as you in the GUI repl, it's only in a tty
repl that the problem occurs.

Cheers,
Chris Dean


Re: *standard-output* with Unicode characters?

> I get the same behavior as you in the GUI repl, it's only in a tty
> repl that the problem occurs.
>
> Cheers,
> Chris Dean

Chris,

It is quite possible that your tty (terminal application) does not
support Unicode or was not built with Unicode support. Unicode support
on Linux is somewhat hit and miss from what I recall.  Some apps
support unicode, others do not.

Jeff


Updated at: 2020-12-10 08:47 UTC