aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
authorrpiazzi <rpiazzi@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-11-03 10:28:49 +0000
committerrpiazzi <rpiazzi@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-11-03 10:28:49 +0000
commitf4a1952fa7ba68366c36d75d3d7233ce9af80259 (patch)
treebd32b610740276204b64249ddb05b71677e8a8e5 /src/main/java/at/gv/egiz
parent9cd5f30c0c44e32d7ec8264b9a30a56fc88d73dd (diff)
downloadpdf-as-3-f4a1952fa7ba68366c36d75d3d7233ce9af80259.tar.gz
pdf-as-3-f4a1952fa7ba68366c36d75d3d7233ce9af80259.tar.bz2
pdf-as-3-f4a1952fa7ba68366c36d75d3d7233ce9af80259.zip
Added workaround for replacing special characters (Umlaute) that since July 2011 aren't rightly encoded by a-trust
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@880 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java60
1 files changed, 53 insertions, 7 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java
index 5766b89..46e46cb 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java
@@ -301,12 +301,11 @@ public class BinarySignator_1_0_0 implements Signator
{
throw new SignatorException(e);
}
-
+
BinarySignature.replaceCertificate(iui);
BinarySignature.replaceTimestamp(iui);
BinarySignature.replacePlaceholders(iui);
-
-// dferbas: alternative sign attrib creation
+ // dferbas: alternative sign attrib creation
// PdfReader reader = new PdfReader(iui.signed_pdf);
//
// OutputStream os = dataSink.createOutputStream(PdfAS.PDF_MIME_TYPE);
@@ -358,14 +357,61 @@ public class BinarySignator_1_0_0 implements Signator
ReplaceInfo ri = (ReplaceInfo) it.next();
String overrideVal = OverridePropertyHolder.getProperty(ri.sfd.field_name);
if (overrideVal != null) {
- ri.sfd.value = overrideVal;
+ ri.sfd.value = overrideVal;
ri.value = overrideVal;
} else if (ognl.containsExpression(ri.sfd.value)) { // dferbas
// evaluate expression
String res = ognl.compileMessage(ri.sfd.value);
-
- ri.value = this.normalizer.normalize(res, true);
-
+ ri.value = this.normalizer.normalize(res, true);
+ //Workaround added by rpiazzi
+ //a-trust wrongly encodes since July 2011, therefore some special characters (e.g. Umlaute) have
+ //to replaced by their right character
+ if ((ri.value.contains("&#252;") || ri.value.contains("&#228;") || ri.value.contains("&#246;") ||
+ ri.value.contains("&#225;") || ri.value.contains("&#223;") || ri.value.contains("&#214;") ||
+ ri.value.contains("&#224;") || ri.value.contains("&#233;") || ri.value.contains("&#250;") ||
+ ri.value.contains("&#231;")) && (ri.sfd.field_name.equals(SignatureTypes.SIG_SUBJECT))) {
+ if (ri.value.contains("&#252;")) {
+ ri.sfd.value = ri.sfd.value.replace("&#252;", "ü");
+ ri.value = ri.value.replace("&#252;", "ü");
+ }
+ if (ri.value.contains("&#228;")) {
+ ri.sfd.value = ri.sfd.value.replace("&#228;", "ä");
+ ri.value = ri.value.replace("&#228;", "ä");
+ }
+ if (ri.value.contains("&#246;")) {
+ ri.sfd.value = ri.sfd.value.replace("&#246;", "ö");
+ ri.value = ri.value.replace("&#246;", "ö");
+ }
+ if (ri.value.contains("&#225;")) {
+ ri.sfd.value = ri.sfd.value.replace("&#225;", "á");
+ ri.value = ri.value.replace("&#225;", "á");
+ }
+ if (ri.value.contains("&#223;")) {
+ ri.sfd.value = ri.sfd.value.replace("&#223;", "ß");
+ ri.value = ri.value.replace("&#223;", "ß");
+ }
+ if (ri.value.contains("&#214;")) {
+ ri.sfd.value = ri.sfd.value.replace("&#214;", "Ö");
+ ri.value = ri.value.replace("&#214;", "Ö");
+ }
+ if (ri.value.contains("&#224;")) {
+ ri.sfd.value = ri.sfd.value.replace("&#224;", "à");
+ ri.value = ri.value.replace("&#224;", "à");
+ }
+ if (ri.value.contains("&#233;")) {
+ ri.sfd.value = ri.sfd.value.replace("&#233;", "é");
+ ri.value = ri.value.replace("&#233;", "é");
+ }
+ if (ri.value.contains("&#250;")) {
+ ri.sfd.value = ri.sfd.value.replace("&#250;", "ú");
+ ri.value = ri.value.replace("&#250;", "ú");
+ }
+ if (ri.value.contains("&#231;")) {
+ ri.sfd.value = ri.sfd.value.replace("&#231;", "ç");
+ ri.value = ri.value.replace("&#231;", "ç");
+ }
+ }
+ //end added
} else if (overrideVal == null) {
//If SUBJECT is not overridden and and also isn't an expression
//check whether a set value for subject exists.