Re: The base-char issue again...

"Steven Githens (as steve at githens dot org)" <[email protected]>
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
Thanks Edward/David!  I ended up using both your suggestions and things 
are working now!  I was totally ignorant of the external-format param 
and the system file encodings setting.  Will be trying this with my 
delivered image tomorrow... :)

Cheers,
Steve

On 9/10/25 6:20 PM, Edward Kiser wrote:
> If writing Unicode characters is what you want, you might need to add 
> an :external-format argument to with-open-file:
>
> (defun test-single-quote3 ()
>    (with-open-file (fs "/Users/sgithens/testlisp-lw.txt" :direction 
> ':output
>                        :external-format '(:utf-8 :eol-style :lf) 
> :if-exists :supersede)
>      (write-line "Some test text2: ’" fs))
>
> On Wed, Sep 10, 2025 at 8:42 PM David McClain (as dbm at 
> refined-audiometrics dot com) <[email protected]> wrote:
>
>     Not sure if you are asking how to rid yourself of unicode, or to
>     allow it.
>
>     I allow UTF-8 encodings everywhere in my LW systems, which allows
>     me to use Greek characters in my function names.
>
>     For that, I have this at the very start of 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 Sep 10, 2025, at 17:13, Steven Githens (as steve at githens
>>     dot org) <[email protected]> wrote:
>>
>>     Hi all,
>>
>>     I'm having a regression of a recurring issue with unicode
>>     characters, which I've fixed in other parts of my code base, but
>>     now I'm having the darnest time trying to write some unicode to a
>>     text file, and after reviewing the mailing list and my other file
>>     access, I can't figure out what the issue is.  It must be
>>     something obvious I'm missing... can anyone see what I'm doing
>>     wrong below.  I've got the default char element type set in
>>     .lispworks.  This is on macOS 8.1.0 ( I haven't upgraded to 8.1.1
>>     yet, but I didn't see anything liek this in the release notes).
>>     Just trying to include unicode chat 0x2019.
>>
>>     Cheers,
>>     Steve
>>
>>
>>     CL-USER 1 > *default-character-element-type*
>>     CHARACTER
>>
>>     CL-USER 2 > (defun test-single-quote ()
>>       (with-open-file (fs "/Users/sgithens/testlisp-lw.txt"
>>     :direction ':output
>>                           :element-type 'character :if-exists :supersede)
>>         (write-line "Some test text2: ’" fs)))
>>     TEST-SINGLE-QUOTE
>>
>>     CL-USER 3 > (test-single-quote)
>>
>>     Error: #\’ (of type CHARACTER) is not of type BASE-CHAR.
>>       1 (abort) Return to top loop level 0.
>>
>>     Type :b for backtrace, or :c <option number> to proceed, or :a to
>>     abort.
>>     Type :bug-form "<subject>" for a bug report template or :? for
>>     other options.
>>
>>     CL-USER 4 : 1 > :top
>>
>>     CL-USER 5 > (defun test-single-quote2 ()
>>       (with-open-file (fs "/Users/sgithens/testlisp-lw.txt"
>>     :direction ':output
>>                           :element-type '(unsigned-byte 8.)
>>     :if-exists :supersede)
>>         (write-line "Some test text2: ’" fs)))
>>     TEST-SINGLE-QUOTE2
>>
>>     CL-USER 6 > (test-single-quote2)
>>
>>     Error: #\’ (of type CHARACTER) is not of type BASE-CHAR.
>>       1 (abort) Return to top loop level 0.
>>
>>     Type :b for backtrace, or :c <option number> to proceed, or :a to
>>     abort.
>>     Type :bug-form "<subject>" for a bug report template or :? for
>>     other options.
>>
>>     _______________________________________________
>>     Lisp Hug - the mailing list for LispWorks users
>>     [email protected]
>>     http://www.lispworks.com/support/lisp-hug.html
>
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.