Opened 3 years ago

Closed 9 months ago

#456 closed defect (fixed)

SYSTEM:AVAILABLE-ENCODINGS symbols strangeness

Reported by: Mark Evenson Owned by: Mark Evenson
Priority: minor Milestone: 1.8.0
Component: other Version:
Keywords: Cc:
Parent Tickets:

Description

In https://github.com/armedbear/abcl/issues/82 Robert Dodier reports

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;
   }

Change History (7)

comment:1 Changed 21 months ago by Mark Evenson

Milestone: 1.6.01.6.1

Ticket retargeted after milestone closed

comment:2 Changed 15 months ago by Mark Evenson

Milestone: 1.6.11.6.2

Ticket retargeted after milestone closed

comment:3 Changed 14 months ago by Mark Evenson

Milestone: 1.6.21.7.0

comment:4 Changed 14 months ago by Mark Evenson

Milestone: 1.7.01.7.1

Ticket retargeted after milestone closed

comment:5 Changed 13 months ago by Mark Evenson

Milestone: 1.7.11.7.2

Ticket retargeted after milestone closed

comment:6 Changed 11 months ago by Mark Evenson

Milestone: 1.7.21.8.0

Milestone renamed

comment:7 Changed 9 months ago by Mark Evenson

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.