Menu

#8 encoding error in the output file

v1.0 (example)
pending
nobody
None
5
2016-05-02
2011-07-07
XingWang
No

When the file to process has a name of Chinese chars, the output xml file will have a encoding error.

First, it is not proper to use write byte for non-English chars.
Second, the xml file has no coding specification.

some advices, for example in FeatureProcessor.java
1.add xml encoding specification
private void writeValuesXMLHeader() throws Exception {
String feature_vector_header = new String("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"

2.use the following instead of the commented line
//values_writer.writeBytes("\t\t<data_set_id>" + identifier+ "</data_set_id>\n");
String tmps = "\t\t<data_set_id>" + identifier+ "</data_set_id>\n";
values_writer.write(tmps.getBytes("utf-8"));

3.it's better to write a function to handler this, for there are many points where non-English chars may be writen.

Discussion

  • Daniel McEnnis

    Daniel McEnnis - 2016-05-02

    I agree, jAudio internationalization support needs work. Fixed character sets for export are important - the locale should not change the output. Adding a ToDo item that the new versions output proper UTF-8 encodings that should resolve your issue.

     
  • Daniel McEnnis

    Daniel McEnnis - 2016-05-02
    • status: open --> pending
     

Log in to post a comment.