Author: ssteiner
Date: Fri Jun 5 14:23:11 2015
New Revision: 1683762
URL: http://svn.apache.org/r1683762
Log:
FOP-2474: AFP Logical element tag incorrect character encoding
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/TagLogicalElement.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/triplets/AttributeValueTriplet.java
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/TagLogicalElement.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/TagLogicalElement.java?rev=1683762&r1=1683761&r2=1683762&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/TagLogicalElement.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/TagLogicalElement.java
Fri Jun 5 14:23:11 2015
@@ -64,7 +64,11 @@ public class TagLogicalElement extends A
}
private void setAttributeValue(String value) {
- addTriplet(new AttributeValueTriplet(value));
+ if (state.encoding != -1) {
+ addTriplet(new AttributeValueTriplet(value, state.encoding));
+ } else {
+ addTriplet(new AttributeValueTriplet(value));
+ }
}
private void setEncoding(int encoding) {
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/triplets/AttributeValueTriplet.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/triplets/AttributeValueTriplet.java?rev=1683762&r1=1683761&r2=1683762&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/triplets/AttributeValueTriplet.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/triplets/AttributeValueTriplet.java
Fri Jun 5 14:23:11 2015
@@ -32,6 +32,8 @@ import org.apache.fop.afp.AFPConstants;
public class AttributeValueTriplet extends AbstractTriplet {
private String attVal;
+ private int userEncoding = -1; //no encoding by default
+
/**
* Main constructor
*
@@ -42,6 +44,11 @@ public class AttributeValueTriplet exten
this.attVal = truncate(attVal, MAX_LENGTH - 4);
}
+ public AttributeValueTriplet(String attVal, int userEncoding) {
+ this(attVal);
+ this.userEncoding = userEncoding;
+ }
+
/** {@inheritDoc} */
public void writeToStream(OutputStream os) throws IOException {
byte[] data = super.getData();
@@ -51,7 +58,11 @@ public class AttributeValueTriplet exten
// convert name and value to ebcdic
byte[] tleByteValue = null;
try {
- tleByteValue = attVal.getBytes(AFPConstants.EBCIDIC_ENCODING);
+ if (this.userEncoding != -1) {
+ tleByteValue = attVal.getBytes("Cp" + userEncoding);
+ } else {
+ tleByteValue = attVal.getBytes(AFPConstants.EBCIDIC_ENCODING);
+ }
} catch (UnsupportedEncodingException usee) {
throw new IllegalArgumentException(attVal + " encoding failed");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]