I see that SYSTEM:AVAILABLE-ENCODINGS returns a list of symbols which represent the various encodings that are discovered via Charset.availableCharsets. That's great, but the symbols are apparently not interned in the keyword package, so it makes it somewhat confusing to determine whether a given encoding is on the list.
e.g. (member :utf-16 (system:available-encodings))
returns NIL, although looking at the list, you can see that :UTF-16
is there.
Confusingly, (mapcar #'symbol-package (system:available-encodings))
shows that all symbols are in the keyword package, but (find-symbol "UTF-16" :keyword)
returns NIL.
I believe the problem is that availableEncodings in src/org/armedbear/lisp/Stream.java says, in part, (at line 399 in the current version)
new Symbol(charset, PACKAGE_KEYWORD)
but I think more appropriate would be
PACKAGE_KEYWORD.intern(charset)
Here is a patch which implements that change, and fixes the bug, from what I can tell.
Index: src/org/armedbear/lisp/Stream.java
===================================================================
--- src/org/armedbear/lisp/Stream.java (revision 15113)
+++ src/org/armedbear/lisp/Stream.java (working copy)
@@ -396,7 +396,7 @@
SortedMap<String, Charset> available = Charset.availableCharsets();
Set<String> encodings = available.keySet();
for (String charset : encodings) {
- result.add(new Symbol(charset, PACKAGE_KEYWORD));
+ result.add (PACKAGE_KEYWORD.intern (charset));
}
return result;
}