Re: utf-8 output in a terminal

"R. Matthew Emerson" <[email protected]> Sat, 27 Jul 2024 22:31:45 -0700
Newsgroups gmane.lisp.openmcl.devel
Message-ID <[email protected]>

> On Jul 27, 2024, at 8:23=E2=80=AFPM, Gr=C3=A9gory Vanuxem =
<[email protected]> wrote:
>=20
> In FriCAS  built on top of Clozure CL I obtain this output in a =
terminal (WSL2)
>=20
> (gamma(x) =C3=83=C3=82=C2=A2=C3=83=C3=82=C3=83=C3=82 reals && Re(x) > =
0) || (x =C3=83=C3=82=C2=A2=C3=83=C3=82=C3=83=C3=82 integers &&
> gamma(x) =C3=83=C3=82=C2=A2=C3=83=C3=82=C3=83=C3=82 reals)
>=20
> instead of (SBCL)
>=20
> (gamma(x) =E2=88=88 reals && Re(x) > 0) || (x =E2=88=89 integers && =
gamma(x) =E2=88=88 reals)
>=20
> if I (print ...) a string with, for example, =E2=88=88, in a pure =
Clozure CL
> (recently git cloned) this is correctly printed, no problem.
>=20
> So I wonder if I have to modify the output stream character encoding
> or the output routine.

Check that the external format of the FriCAS output stream is what you =
expect. In other words, if you pass an explicit :external-format =
argument to cl:open, make sure it matches what your terminal requires.

Doing (describe *terminal-io*) might show something interesting. =
Here=E2=80=99s what it shows for me:

? (describe *terminal-io*)     =20
#<ECHOING-TWO-WAY-STREAM input #<BASIC-CHARACTER-INPUT-STREAM UTF-8 =
(TTY/0) #x1824C7D6>, output #<BASIC-CHARACTER-OUTPUT-STREAM UTF-8 =
(TTY/1) #x1824C2A6> #x1825FBE6>
Class: #<STANDARD-CLASS ECHOING-TWO-WAY-STREAM>
Wrapper: #<CLASS-WRAPPER ECHOING-TWO-WAY-STREAM #x18039A16>
Instance slots
SHARED-RESOURCE: NIL
OPEN-P: T
INPUT-STREAM: #<BASIC-CHARACTER-INPUT-STREAM UTF-8 (TTY/0) #x1824C7D6>
OUTPUT-STREAM: #<BASIC-CHARACTER-OUTPUT-STREAM UTF-8 (TTY/1) #x1824C2A6>

The default external format has been #<EXTERNAL-FORMAT :UTF-8/:UNIX =
#x18249C6E> for quite a long time now.=20

https://ccl.clozure.com/docs/ccl.html#characters-and-external-formats


>=20
> And more importantly, how can I achieve that?
>=20
> - Greg
>=20
> PS:
> (1) -> )lisp CCL:*DEFAULT-EXTERNAL-FORMAT*
> Value =3D :UNIX