diff options
author | rpiazzi <rpiazzi@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2011-11-03 10:28:49 +0000 |
---|---|---|
committer | rpiazzi <rpiazzi@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2011-11-03 10:28:49 +0000 |
commit | f4a1952fa7ba68366c36d75d3d7233ce9af80259 (patch) | |
tree | bd32b610740276204b64249ddb05b71677e8a8e5 /src/main/java/at/gv | |
parent | 9cd5f30c0c44e32d7ec8264b9a30a56fc88d73dd (diff) | |
download | pdf-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')
-rw-r--r-- | src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java | 60 |
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("ü") || ri.value.contains("ä") || ri.value.contains("ö") ||
+ ri.value.contains("á") || ri.value.contains("ß") || ri.value.contains("Ö") ||
+ ri.value.contains("à") || ri.value.contains("é") || ri.value.contains("ú") ||
+ ri.value.contains("ç")) && (ri.sfd.field_name.equals(SignatureTypes.SIG_SUBJECT))) {
+ if (ri.value.contains("ü")) {
+ ri.sfd.value = ri.sfd.value.replace("ü", "ü");
+ ri.value = ri.value.replace("ü", "ü");
+ }
+ if (ri.value.contains("ä")) {
+ ri.sfd.value = ri.sfd.value.replace("ä", "ä");
+ ri.value = ri.value.replace("ä", "ä");
+ }
+ if (ri.value.contains("ö")) {
+ ri.sfd.value = ri.sfd.value.replace("ö", "ö");
+ ri.value = ri.value.replace("ö", "ö");
+ }
+ if (ri.value.contains("á")) {
+ ri.sfd.value = ri.sfd.value.replace("á", "á");
+ ri.value = ri.value.replace("á", "á");
+ }
+ if (ri.value.contains("ß")) {
+ ri.sfd.value = ri.sfd.value.replace("ß", "ß");
+ ri.value = ri.value.replace("ß", "ß");
+ }
+ if (ri.value.contains("Ö")) {
+ ri.sfd.value = ri.sfd.value.replace("Ö", "Ö");
+ ri.value = ri.value.replace("Ö", "Ö");
+ }
+ if (ri.value.contains("à")) {
+ ri.sfd.value = ri.sfd.value.replace("à", "à");
+ ri.value = ri.value.replace("à", "à");
+ }
+ if (ri.value.contains("é")) {
+ ri.sfd.value = ri.sfd.value.replace("é", "é");
+ ri.value = ri.value.replace("é", "é");
+ }
+ if (ri.value.contains("ú")) {
+ ri.sfd.value = ri.sfd.value.replace("ú", "ú");
+ ri.value = ri.value.replace("ú", "ú");
+ }
+ if (ri.value.contains("ç")) {
+ ri.sfd.value = ri.sfd.value.replace("ç", "ç");
+ ri.value = ri.value.replace("ç", "ç");
+ }
+ }
+ //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.
|