have tests for visualization and ubl convert. Insist in UTF-8 as charset in more cases.
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class CustomXMLProvider implements IXMLProvider {
|
||||
|
||||
protected byte[] zugferdData;
|
||||
@@ -29,7 +31,7 @@ public class CustomXMLProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
public void setXML(byte[] newData) {
|
||||
String zf = new String(newData);
|
||||
String zf = new String(newData, StandardCharsets.UTF_8);
|
||||
if (!zf.contains("CrossIndustry")) {
|
||||
throw new RuntimeException("ZUGFeRD XML does not contain (<rsm:)CrossIndustry and can thus not be valid");
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
@@ -77,7 +78,7 @@ public class ZUGFeRDVisualizer {
|
||||
FileInputStream fis=new FileInputStream(xmlFilename);
|
||||
String fileContent="";
|
||||
try {
|
||||
fileContent = new String(Files.readAllBytes(Paths.get(xmlFilename)));
|
||||
fileContent = new String(Files.readAllBytes(Paths.get(xmlFilename)), StandardCharsets.UTF_8);
|
||||
} catch (IOException e2) {
|
||||
LOG.log(Level.SEVERE, null, e2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user