Ignore:
Timestamp:
05/17/11 15:40:16 (14 years ago)
Author:
sherbold
Message:
  • fixed bug regarding encoding of XML files
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/LogPreprocessor.java

    r1 r44  
    33import java.io.File; 
    44import java.io.FileNotFoundException; 
     5import java.io.FileOutputStream; 
    56import java.io.FileReader; 
    6 import java.io.FileWriter; 
    77import java.io.IOException; 
     8import java.io.OutputStreamWriter; 
    89 
    910import org.apache.commons.codec.binary.Base64; 
     
    2829         
    2930        public void convertToXml(String source, String target) throws IOException, FileNotFoundException { 
    30                 FileWriter targetFile = new FileWriter(target); 
    31                 targetFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + StringTools.ENDLINE); 
     31                OutputStreamWriter targetFile = new OutputStreamWriter(new FileOutputStream(target), "UTF-16"); 
     32                targetFile.write("<?xml version=\"1.0\" encoding=\"UTF-16\"?>" + StringTools.ENDLINE); 
    3233                targetFile.write("<log>" + StringTools.ENDLINE); 
    3334                processFile(source, targetFile); 
     
    4142         
    4243        public void convertDirToXml(String path, String target) throws IOException, FileNotFoundException { 
    43                 FileWriter targetFile = new FileWriter(target); 
    44                 targetFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + StringTools.ENDLINE); 
     44                OutputStreamWriter targetFile = new OutputStreamWriter(new FileOutputStream(target), "UTF-16"); 
     45                targetFile.write("<?xml version=\"1.0\" encoding=\"UTF-16\"?>" + StringTools.ENDLINE); 
    4546                targetFile.write("<log>" + StringTools.ENDLINE); 
    4647                File folder = new File(path); 
     
    6263        } 
    6364 
    64         private void processFile(String source, FileWriter targetFile) 
     65        private void processFile(String source, OutputStreamWriter targetFile) 
    6566                        throws FileNotFoundException, IOException { 
    6667                File f = new File(source); 
Note: See TracChangeset for help on using the changeset viewer.