Python-ml-jp

すいません、SPAM扱いされていたメールが今夜になって連続で届いたようですm(_ _)m

Jython2.2を触って幾つか

  • Jythonの最新版Jython2.2だと日本語をうまく扱えない
  • ダウンロードしてすぐantは通らない

となるので動作させる為に

  • InteractiveInterpreter#runsourceにパッチをあてる
  • build.xmlを修正

で対応。

別の方はparser.javaに処理をされていました。


という事で、Jythonのソースを結構読んだのでした。
【追記】patchは以下です

--- InteractiveInterpreter.java~        2007-08-23 18:37:52.000000000 +0900
+++ InteractiveInterpreter.java 2007-08-28 22:37:52.000000000 +0900
@@ -1,6 +1,7 @@
 // Copyright (c) Corporation for National Research Initiatives
 package org.python.util;

+import java.io.UnsupportedEncodingException;
 import org.python.core.*;

 // Based on CPython-1.5.2's code module
@@ -51,6 +52,11 @@
     }

     public boolean runsource(String source, String filename, String symbol) {
+        try {
+            source = new String(source.getBytes("ISO-8859-1"));
+        } catch (UnsupportedEncodingException ex) {
+            source = new String(source.getBytes());
+        }
         PyObject code;
         try {
             code = Py.compile_command_flags(source, filename, symbol, cflags,