Force exteral-format utf-8 when reading method-library.data

Issue #5 resolved
Yehouda Harpaz created an issue

The current code in read-method-library opens *method-library-path* without specifying the external format, but it has to be utf-8 to read it correctly, so if the default external format is not utf-8, it doesn’t read it correctly. That is also true for writing the file in convert-xml-method-file.

The test gives many failues because it gets method names wrong.

I fixed it by adding :external-format:

read-method-library (https://bitbucket.org/dfmorrison/roan/src/master/method.lisp#lines-2902):

 (with-open-file (in path :external-format asdf:*UTF-8-EXTERNAL-FORMAT*)

convert-xml-method-file ( https://bitbucket.org/dfmorrison/roan/src/master/method.lisp#lines-3059):

 (with-open-file (out library-file :direction :output :if-exists :supersede
                              :external-format asdf:*UTF-8-EXTERNAL-FORMAT*)

With these fixes there are no failures in roan/test anymore.

There maybe other cases of opening files that need that too.

It is probably better to have a macro like with-open-roan-file that expands to with-open-file and adds the :external-format, and use it instead of with-opne-file where relevant.

Comments (1)

  1. Log in to comment