How to change external-format in SBCL (c-string encoding error)


I have a problem with how to redefine the external format used in SBCL
after starting it up. At least this is what I think I have a problem

When I run this code:

(DIRECTORY "/big/dat/gfx/mp3/artist/T*/*.mp3")

I get this error:

c-string encoding error (:external-format :ASCII):
the character with code 195 cannot be encoded.

0: [ABORT-REQUEST] Abort handling SLIME request.
1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-
thread" {BE70D91}>)

1: (SB-IMPL::OUTPUT-TO-C-STRING/ASCII "/big/dat/gfx/mp3/artist/Tommy
2: (SB-UNIX:UNIX-STAT "/big/dat/gfx/mp3/artist/Tommy Körberg")
3: (SB-IMPL::%ENUMERATE-DIRECTORIES "/big/dat/gfx/mp3/artist/" (#<SB-
IMPL::PATTERN ("T" :MULTI-CHAR-WILD)>) #P"/big/dat/gfx/mp3/artist/T*/
*.mp3" T T ((837 . 1360279) (837 . 1343489) (837 . 1146908) (837 .
1146881) (837 . 2)) #<CLOSURE (LAMBDA (SB-IMPL::MATCH)) {BF9C1DD}>)
4: ((LABELS SB-IMPL::DO-DIRECTORY) #P"/big/dat/gfx/mp3/artist/T*/
5: (DIRECTORY "/big/dat/gfx/mp3/artist/T*/*.mp3")
6: (SB-INT:SIMPLE-EVAL-IN-LEXENV (DIRECTORY "/big/dat/gfx/mp3/artist/
T*/*.mp3") #<NULL-LEXENV>)
7: (SWANK::EVAL-REGION "(directory \"/big/dat/gfx/mp3/artist/T*/

The reason of course is that the file name above contain non-ASCII

Now, this only happens when my program is started as a system service
(I am running SBCL 1.0 under Mandriva GNU/Linux) but not if I start it
"manually" from the command line. I think I know why I get this
behavior but not how to solve the problem:

I am using UTF-8 as the default encoding in my system and when I start
SBCL from the command line it correctly inherits this:

* (sb-impl::default-external-format)


However, when SBCL is started as a system service I get this instead:

* (sb-impl::default-external-format)


I have tried to change the default format like this, but I have no
idea if I am on the right track:

* (setf sb-impl::*default-external-format*) :UTF-8)

It does not solve my problem however, so it seems there are other
internal variables in SBCL that determines the encoding to use in the
call to (SB-UNIX:UNIX-STAT "/big/dat/gfx/mp3/artist/Tommy Körberg").

Any ideas on how to tackle this?


PS. It might be possible to tweak the script that defines the service
and change the default encoding there, but I am more interested in
learning how to solve this from inside SBCL.

PPS. I have tried to search the documentation for encoding and formats
etc, to no avail. Is there any place where I could have found the
answer myself?


Relevant Pages