Changeset 12330


Ignore:
Timestamp:
01/04/10 21:57:52 (12 years ago)
Author:
ehuelsmann
Message:

Fix ticket #77: incorrect encoding used for FASLs, by always using UTF-8.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Load.java

    r12306 r12330  
    446446    // internal symbol
    447447    private static final Symbol _FASL_VERSION_ =
    448         exportConstant("*FASL-VERSION*", PACKAGE_SYS, Fixnum.getInstance(34));
     448        exportConstant("*FASL-VERSION*", PACKAGE_SYS, Fixnum.getInstance(35));
     449
     450    // ### *fasl-external-format*
     451    // internal symbol
     452    private static final Symbol _FASL_EXTERNAL_FORMAT_ =
     453        internConstant("*FASL-EXTERNAL-FORMAT*", PACKAGE_SYS,
     454                       new SimpleString("UTF-8"));
    449455
    450456    // ### *fasl-anonymous-package*
     
    610616            thread.bindSpecial(AUTOLOADING_CACHE,
    611617                               AutoloadedFunctionProxy.makePreloadingContext());
     618            in.setExternalFormat(_FASL_EXTERNAL_FORMAT_.symbolValue(thread));
    612619            while (true) {
    613620                LispObject obj = in.faslRead(false, EOF, true, thread);
  • trunk/abcl/src/org/armedbear/lisp/Stream.java

    r12329 r12330  
    5353import java.util.BitSet;
    5454
     55import org.armedbear.lisp.util.DecodingReader;
    5556
    5657/** The stream class
     
    144145    if (elementType == Symbol.CHARACTER || elementType == Symbol.BASE_CHAR)
    145146      {
    146         InputStreamReader inputStreamReader =
    147             (encoding == null) ?
    148                 new InputStreamReader(inputStream)
    149                 : new InputStreamReader(inputStream,
    150                     Charset.forName(encoding).newDecoder());
    151         initAsCharacterInputStream(new BufferedReader(inputStreamReader));
     147        Reader reader =
     148            new DecodingReader(inputStream, 4096,
     149                               (encoding == null)
     150                               ? Charset.defaultCharset()
     151                               : Charset.forName(encoding));
     152        initAsCharacterInputStream(reader);
    152153      }
    153154    else
     
    332333    eolChar = (eolStyle == EolStyle.CR) ? '\r' : '\n';
    333334    externalFormat = format;
     335
     336    if (reader != null
     337        && reader instanceof DecodingReader)
     338        ((DecodingReader)reader).setCharset(Charset.forName(encoding));
    334339  }
    335340 
  • trunk/abcl/src/org/armedbear/lisp/compile-file.lisp

    r12310 r12330  
    503503        (with-compilation-unit ()
    504504          (with-open-file (out temp-file
    505                                :direction :output :if-exists :supersede)
     505                               :direction :output :if-exists :supersede
     506                               :external-format *fasl-external-format*)
    506507            (let ((*readtable* *readtable*)
    507508                  (*read-default-float-format* *read-default-float-format*)
Note: See TracChangeset for help on using the changeset viewer.