Use UTF-8 when creating new Strings from byte[].
This commit is contained in:
@@ -182,7 +182,7 @@ public class DAPullProvider extends ZUGFeRD2PullProvider {
|
||||
// Additional Documents of XRechnung (Rechnungsbegruendende Unterlagen - BG-24 XRechnung)
|
||||
if (trans.getAdditionalReferencedDocuments() != null) {
|
||||
for (final FileAttachment f : trans.getAdditionalReferencedDocuments()) {
|
||||
final String documentContent = new String(Base64.getEncoder().encodeToString(f.getData()));
|
||||
final String documentContent = Base64.getEncoder().encodeToString(f.getData());
|
||||
xml += "<ram:AdditionalReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>" + f.getFilename() + "</ram:IssuerAssignedID>"
|
||||
+ "<ram:TypeCode>916</ram:TypeCode>"
|
||||
|
||||
@@ -257,7 +257,7 @@ public class OXPullProvider extends ZUGFeRD2PullProvider {
|
||||
// Additional Documents of XRechnung (Rechnungsbegruendende Unterlagen - BG-24 XRechnung)
|
||||
if (trans.getAdditionalReferencedDocuments() != null) {
|
||||
for (final FileAttachment f : trans.getAdditionalReferencedDocuments()) {
|
||||
final String documentContent = new String(Base64.getEncoder().encodeToString(f.getData()));
|
||||
final String documentContent = Base64.getEncoder().encodeToString(f.getData());
|
||||
xml += "<ram:AdditionalReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>" + f.getFilename() + "</ram:IssuerAssignedID>"
|
||||
+ "<ram:TypeCode>916</ram:TypeCode>"
|
||||
|
||||
@@ -117,7 +117,7 @@ public class UBLDAPullProvider implements IXMLProvider {
|
||||
final StringWriter sw = new StringWriter();
|
||||
Document document = null;
|
||||
try {
|
||||
document = DocumentHelper.parseText(new String(ublData));
|
||||
document = DocumentHelper.parseText(new String(ublData, StandardCharsets.UTF_8));
|
||||
} catch (final DocumentException e1) {
|
||||
LOGGER.error ("Failed to parse UBL", e1);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider {
|
||||
final StringWriter sw = new StringWriter();
|
||||
Document document = null;
|
||||
try {
|
||||
document = DocumentHelper.parseText(new String(zugferdData));
|
||||
document = DocumentHelper.parseText(new String(zugferdData, StandardCharsets.UTF_8));
|
||||
} catch (final DocumentException e1) {
|
||||
LOGGER.error ("Failed to parse ZUGFeRD data", e1);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
final StringWriter sw = new StringWriter();
|
||||
Document document = null;
|
||||
try {
|
||||
document = DocumentHelper.parseText(new String(zugferdData));
|
||||
document = DocumentHelper.parseText(new String(zugferdData, StandardCharsets.UTF_8));
|
||||
} catch (final DocumentException e1) {
|
||||
LOGGER.error("Failed to parse ZUGFeRD data", e1);
|
||||
}
|
||||
@@ -620,7 +620,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
// Additional Documents of XRechnung (Rechnungsbegruendende Unterlagen - BG-24 XRechnung)
|
||||
if (trans.getAdditionalReferencedDocuments() != null) {
|
||||
for (final FileAttachment f : trans.getAdditionalReferencedDocuments()) {
|
||||
final String documentContent = new String(Base64.getEncoder().encodeToString(f.getData()));
|
||||
final String documentContent = Base64.getEncoder().encodeToString(f.getData());
|
||||
xml += "<ram:AdditionalReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>" + f.getFilename() + "</ram:IssuerAssignedID>"
|
||||
+ "<ram:TypeCode>916</ram:TypeCode>"
|
||||
|
||||
@@ -14,6 +14,7 @@ package org.mustangproject.ZUGFeRD;
|
||||
* @author jstaerk
|
||||
*/
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@@ -479,7 +480,7 @@ public class ZUGFeRDImporter extends ZUGFeRDInvoiceImporter {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new String(rawXML);
|
||||
return new String(rawXML, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1223,7 +1223,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
return null;
|
||||
}
|
||||
if (rawXML.length < 3) {
|
||||
return new String(rawXML);
|
||||
return new String(rawXML, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user