-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
to-file: stream decoding error on windows #90
Comments
It would be just a parameter to add to
In my .sbclrc I have (setf sb-impl::*default-external-format* :utf-8) so we probably should respect the user's setting and not enforce it. |
Yeah One way whould be with feature expression: (defun to-file (pathname s &key (if-exists :supersede)
(if-does-not-exist :create )
(:external-format #-sbcl :default #+sbcl :utf-8)) Another solution would be using a (defun to-file (pathname s &key (if-exists :supersede)
(if-does-not-exist :create)
(external-format :default))
(handler-case
(with-open-file (f pathname :direction :output :if-exists if-exists
:if-does-not-exist if-does-not-exist
:external-format external-format)
(write-sequence s f))
(sb-int:stream-decoding-error ()
(with-open-file (f pathname :direction :output :if-exists if-exists
:if-does-not-exist if-does-not-exist
:external-format :utf-8)
(write-sequence s f))))) |
On Windows, portacle (sbcl) 64-bit:
The CP1252 stream decoding error because character with code XXXX cannot be encoded. Appears when using to-file (sbcl) for certain files.
This should reproduce the error on portacle windows 64bit
Here is a thread that deals with the problem:
The solution in this case is to use
:external-format :utf-8
but I'm not sure whether this would be safe for other implementations / operating-systems / architectures?The text was updated successfully, but these errors were encountered: