ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carfield Yim" <carfi...@carfield.com.hk>
Subject Copy with filter have error on unicode
Date Fri, 31 Jan 2003 18:04:44 GMT
Hi, I try to write a simple ant task which act like a resource bundle on J2ME code, which using
[copy] task to convert java file like this

        final Command cmSelect = new Command("@button.select@", Command.OK, 1);
to 
        final Command cmSelect = new Command("GO!", Command.OK, 1);

It work well in English, however, if I try to put some Chinese to replace the token, It change
the text as something like

    [javac]         final Command cmSelect = new Command("?œç?å²?, Command.OK, 1);

Here is the code snap


    // The method executing the task
    public void execute() throws BuildException {
        copy.setEncoding("UTF-8");
        copy.setOverwrite(true);
        copy.setProject(this.getProject());
        FilterSet fs = copy.createFilterSet();
        for(int j=0; j<propKeys.size(); j++) {
            String key = (String)propKeys.get(j);
            fs.addFilter(key, property.getProperty(key));
        }
        replace(directory);
    }

    private void replace(File dir) {
        if(dir.listFiles() == null) return;
        File[] files = dir.listFiles();
        for(int i=0; i<files.length; i++) {
            File thisFile = files[i];
            if(thisFile.isDirectory()) {
                replace(thisFile);
            }
            else if (!thisFile.toString().endsWith("java")) {
                File toFile = new File(thisFile.getPath()+".java");
                copy.setFile(thisFile);
                copy.setTofile(toFile);
                copy.execute();
            }
        }
    }

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message