Lisp HUG Maillist Archive

UTF-8 source code and the LispWorks IDE

Hi,

I was writing a short overview mail about some UTF-8 issues and LispWorks and I thought to share it here. Maybe there is some feedback?



== Background

Some software might use UTF-8 to:

* to use UTF-8 characters in source code
* to compute UTF-8 characters, strings, etc in their code
* to do input and output of UTF-8 characters/strings

Now we have issues:

* how to build such a software
* how to use it in a terminal
* how to use it in the LispWorks IDE
* how to use it other IDEs (GNU Emacs / SLIME with LispWorks for example)



== LispWorks

use the latest, currently 7.1.1.


== ASDF (portable system building tool)

Use ASDF 3.3.3 . It knows that LispWorks supports UTF-8. Prior versions don't.
The version included with LispWorks 7.1.1 is slightly older.
ASDF 3.3.3 will for example load and compile files with UTF-8 as the default encoding.

See: https://bugs.launchpad.net/asdf/+bug/1766618


== Automagically open files with UTF-8 encoding recognized

Use something like this in your .lispworks  init file:

(pushnew :utf-8 system:*specific-valid-file-encodings*)

LispWorks will then recognize UTF-8 files automatically. So the editor will open the files with the UTF-8 encoding and the compiler will use that encoding, too.


== Attribute line of text files

It's also possible to put the information about the encoding into the attribute line of a file.
This is a feature used by some Emacs-like editors.

Put this into the file attribute line, i.e. the first line of a source or otherwise text file:

;;;-*- coding: utf-8 -*-

Then the IDE and the compiler will recognize that this file is using UTF-8 encoded text. GNU Emacs will also recognize that.


== Characters and strings

To have LispWorks supporting the full range of 32bit characters in strings, etc. use this in your init file:

(lw:set-default-character-element-type 'cl:character)

Otherwise it might be for example BASE-CHAR (8bit) or LW:BMP-CHAR  (16bit).
See the LispWorks documentation for  lw:set-default-character-element-type  and related.


== LispWorks Editor: change the encoding used in a buffer

Use

   M-x Set External Format UTF-8 


== Terminal

I don't think the current LispWorks is ready to deal with UTF-8 in the terminal (-> input/output). Right?
If you want to work with UTF-8 encodings in I/O, then use the LispWorks IDE or similar.
I think it was mentioned that this might be a future feature.





Any comments/additions/improvements?


Regards

Rainer Joswig








Re: UTF-8 source code and the LispWorks IDE

Unable to parse email body. Email id is 14947

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