Re: Changing the buffer encoding.

"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]>
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
I set my global to UTF-8 by default. I don’t use modelines in .lisp files. Emacs complains about the UTF-8 modeline encoding anyway. I have had zero problems with this, and I use Greek letters in lots of my Lisp code...



> On Dec 2, 2025, at 11:00, Marco Antoniotti (as marco dot antoniotti at unimib dot it) <[email protected]> wrote:
> 
> Hi
> 
> I got it and I can now reproduce the issue.
> 
> Case 1, my original one, the one that confused me.
> Open buffer, paste stuff with UTF-8 characters (modeline may or may not say LATIN-1), change the encoding to UTF-8, save.
> Re-opening the file shows character as "multibyte" (that's what I call them), not as originally pasted.
> 
> Case 2, new test, that points to the "solution".
> Open buffer, change the encoding to UTF-8, then paste stuff with UTF-8 characters (modeline says UTF-8), save.
> Re-opening the file shows the character as originally pasted.
> 
> All of this on LWM.  I can test it on Windows (and Linux).
> 
> Bottom line.  I think I will just globally set the encoding to UTF-8.  Do you see any problem with that?
> 
> All the best
> 
> Marco
> 
> 
> 
> 
> On Tue, Dec 2, 2025 at 5:27 PM Martin Simmons <[email protected] <mailto:[email protected]>> wrote:
>> Yes, that is because :latin-1 allows any sequence of bytes so it is always a
>> "valid" encoding.
>> 
>> The -*- Encoding: option at the start of the file should override
>> system:*specific-valid-file-encodings* though when using the default order in
>> system:*file-encoding-detection-algorithm*.
>> 
>> -- 
>> Martin Simmons
>> LispWorks Ltd
>> http://www.lispworks.com/
>> 
>> 
>> 
>> >>>>> On Tue, 2 Dec 2025 08:29:20 -0700, David McClain said:
>> > 
>> > I found, for myself a few years ago, that the order of external format specifications is significant. So my ordering is as follows in my .LISPWORKS file:
>> > 
>> > #+:LISPWORKS
>> > (progn
>> >   (pushnew :LATIN-1 system:*specific-valid-file-encodings*)
>> >   (pushnew :utf-8 system:*specific-valid-file-encodings*)
>> > 
>> >   (lw:set-default-character-element-type 'cl:character))
>> > 
>> > 
>> > > On Dec 2, 2025, at 08:13, Martin Simmons <[email protected] <mailto:[email protected]>> wrote:
>> > > 
>> > > Does the editor's modeline still start with LATIN-1 after closing and opening
>> > > the file?
>> > > 
>> > > The attached file containing the characters #\U+636E and #\U+646F works for
>> > > me, with the modeline saying UTF-8.
>> > > 
>> > > -- 
>> > > Martin Simmons
>> > > LispWorks Ltd
>> > > http://www.lispworks.com/
>> > > 
>> > > 
>> > > 
>> > >>>>>> On Tue, 2 Dec 2025 13:40:19 +0100, Marco Antoniotti said:
>> > >> 
>> > >> Hi
>> > >> 
>> > >> I am fooling around and I did save it with Encoding: UTF-8
>> > >> 
>> > >> No luck.
>> > >> 
>> > >> MA
>> > >> 
>> > >> 
>> > >> On Tue, Dec 2, 2025 at 1:39 PM Martin Simmons <[email protected] <mailto:[email protected]>> wrote:
>> > >> 
>> > >>> It should be UTF-8, not UNICODE (assuming that is how you saved it).
>> > >>> 
>> > >>> --
>> > >>> Martin Simmons
>> > >>> LispWorks Ltd
>> > >>> http://www.lispworks.com/
>> > >>> 
>> > >>> 
>> > >>> 
>> > >>>>>>>> On Tue, 2 Dec 2025 11:39:38 +0100, Marco Antoniotti (as marco dot
>> > >>> antoniotti at unimib dot it) said:
>> > >>>> 
>> > >>>> Thanks.
>> > >>>> 
>> > >>>> I ended up RTFM 😏
>> > >>>> 
>> > >>>> Now a different problem.
>> > >>>> 
>> > >>>> I can now save the data in a file, but when I read it back, even adding
>> > >>> the
>> > >>>> "-*- Encoding: UNICODE -*- header, the characters are not displayed
>> > >>>> correctly: read, their glyphs (*) are not used for display.
>> > >>>> 
>> > >>>> MA
>> > >>>> 
>> > >>>> (*) Pardon the use of incorrect terminology.
>> > >>>> 
>> > >>>> 
>> > >>>> On Tue, Dec 2, 2025 at 8:59 AM joswig <[email protected] <mailto:[email protected]>> wrote:
>> > >>>> 
>> >>>>> set external format
>> > >>>>> 
>> > >>>>> 
>> >>>>> Am 02.12.2025 um 08:34 schrieb Marco Antoniotti (as marco dot
>> > >>> antoniotti
>> >>>>> at unimib dot it) <[email protected] <mailto:[email protected]>>:
>> > >>>>> 
>> >>>>> Hi
>> > >>>>> 
>> >>>>> asking is always faster and easier than RTFM.
>> > >>>>> 
>> >>>>> I just pasted some code containing UTF-8 characters in a buffer (this
>> > >>> is
>> >>>>> LWM).  Now I cannot save it because the buffer is marked LATIN-1.
>> > >>>>> 
>> >>>>> How do I change the buffer encoding in order to save as-is.
>> > >>>>> 
>> >>>>> Thanks
>> > >>>>> 
>> >>>>> Marco
>> > >>>>> 
>> >>>>> --
>> >>>>> Marco Antoniotti, Professor, Director         tel. +39 - 02 64 48 79 01
>> >>>>> DISCo, University of Milan-Bicocca U14 2043
>> > >>> http://dcb.disco.unimib.it <http://dcb.disco.unimib.it/>
>> >>>>> Viale Sarca 336
>> >>>>> I-20126 Milan (MI) ITALY
>> > >>>>> 
>> >>>>> REGAINS: https://regains.disco.unimib.it/
>> > >>>>> 
>> > >>>>> 
>> > >>>>> 
>> > >>>> 
>> > >>>> --
>> > >>>> Marco Antoniotti, Professor, Director         tel. +39 - 02 64 48 79 01
>> > >>>> DISCo, University of Milan-Bicocca U14 2043   http://dcb.disco.unimib.it <http://dcb.disco.unimib.it/>
>> > >>>> Viale Sarca 336
>> > >>>> I-20126 Milan (MI) ITALY
>> > >>>> 
>> > >>>> REGAINS: https://regains.disco.unimib.it/
>> > >>>> 
>> > >>>> _______________________________________________
>> > >>>> Lisp Hug - the mailing list for LispWorks users
>> > >>>> [email protected] <mailto:[email protected]>
>> > >>>> http://www.lispworks.com/support/lisp-hug.html
>> > >>>> 
>> > >>> 
>> > >> 
>> > >> 
>> > >> -- 
>> > >> Marco Antoniotti, Professor, Director         tel. +39 - 02 64 48 79 01
>> > >> DISCo, University of Milan-Bicocca U14 2043   http://dcb.disco.unimib.it <http://dcb.disco.unimib.it/>
>> > >> Viale Sarca 336
>> > >> I-20126 Milan (MI) ITALY
>> > >> 
>> > >> REGAINS: https://regains.disco.unimib.it/
>> > >> 
>> > > <utf8.txt>
>> > 
>> >
> 
> 
> 
> --
> Marco Antoniotti, Professor, Director         tel. +39 - 02 64 48 79 01
> DISCo, University of Milan-Bicocca U14 2043   http://dcb.disco.unimib.it <http://dcb.disco.unimib.it/>
> Viale Sarca 336
> I-20126 Milan (MI) ITALY
> 
> REGAINS: https://regains.disco.unimib.it/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.