Lisp HUG Maillist Archive

defsystem and unicode file

Hello -

How can I tell defsystem that files in the :members list should be loaded as unicode files (i.e. :external-format :utf-8)? I have utf-8 files with Russian text and can't figure out how to load those files with defsystem properly.

Best,
 Art


Re: defsystem and unicode file

Hello,

I used this trick (from LW documentation):

22.6.3.1 Example of using UTF-8 by default

To change the default for all file access via open, compile-file and
so on, you can modify the value of
*file-encoding-detection-algorithm*.

For example given the following definition:

(defun utf-8-file-encoding (pathname ef-spec buffer length)
  (declare (ignore pathname buffer length))
  (system:merge-ef-specs ef-spec :utf-8))

then this makes it use UTF-8 as a fallback:

(setq system:*file-encoding-detection-algorithm*
      (substitute 'utf-8-file-encoding
                  'system:locale-file-encoding
                  system:*file-encoding-detection-algorithm*))

and this forces it to always use UTF-8:

(setq system:*file-encoding-detection-algorithm*
      '(utf-8-file-encoding))

On Tue, Aug 23, 2011 at 6:01 PM, Art Obrezan <artobrezan@yahoo.com> wrote:
>
> Hello -
>
> How can I tell defsystem that files in the :members list should be loaded as unicode files (i.e. :external-format :utf-8)? I have utf-8 files with Russian text and can't figure out how to load those files with defsystem properly.
>
> Best,
>  Art
>
>



-- 
--ska


Re: defsystem and unicode file

Thanks, Kamil for the trick and the reference to the docs.

To the LW guys (I presume they'll notice this message :)

Please add an :external-format option to the options of defsystem (meaning use that external-format for all system's files) and :external-format to the member list (meaning use a particular encoding for only this file).

Best,
 Art 

--- On Tue, 8/23/11, Kamil Shakirov <kamils80@gmail.com> wrote:

> From: Kamil Shakirov <kamils80@gmail.com>
> Subject: Re: defsystem and unicode file
>
> I used this trick (from LW documentation): 
> 22.6.3.1 Example of using UTF-8 by default
> 


Re: defsystem and unicode file

Unable to parse email body. Email id is 11199

Re: defsystem and unicode file

Thanks, the line ";; -*- external-format: utf-8; -*-" at the beginning of a file helped! :)

Best,
 Art

> Have you tried the ENCODING or EXTERNAL-FORMAT modeline
> option?  That will set
> the default for the editor as well as
> load/compile-file/compile-system.
> 
> See http://www.lispworks.com/documentation/lw60/LW/html/lw-469.htm


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