How to change external-format in SBCL (c-string encoding error)
- From: Mathias Dahl <mathias.dahl@xxxxxxxxx>
- Date: Sun, 17 Jun 2007 09:22:38 -0700
Hi!
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
with...
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.
[Condition of type SB-INT:C-STRING-ENCODING-ERROR]
Restarts:
0: [ABORT-REQUEST] Abort handling SLIME request.
1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-
thread" {BE70D91}>)
Backtrace:
0: (SB-INT:C-STRING-ENCODING-ERROR :ASCII 195)
1: (SB-IMPL::OUTPUT-TO-C-STRING/ASCII "/big/dat/gfx/mp3/artist/Tommy
Körberg")
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*/
*.mp3")
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*/
*.mp3\")
The reason of course is that the file name above contain non-ASCII
characters.
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)
:UTF-8
However, when SBCL is started as a system service I get this instead:
* (sb-impl::default-external-format)
:ANSI_X3.4-1968
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?
/Mathias
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?
.
- Follow-Ups:
- Re: How to change external-format in SBCL (c-string encoding error)
- From: Richard M Kreuter
- Re: How to change external-format in SBCL (c-string encoding error)
- From: Pascal Bourguignon
- Re: How to change external-format in SBCL (c-string encoding error)
- Prev by Date: Re: A problem statement (and a proposed solution)
- Next by Date: Re: How to change external-format in SBCL (c-string encoding error)
- Previous by thread: FORMAT ~{~A ~} and carriage return
- Next by thread: Re: How to change external-format in SBCL (c-string encoding error)
- Index(es):
Relevant Pages
|