Permalink
Browse files

Resolve issue #41, make sure @encoding is added to c:data elements wh…

…en Unzip base64 encodes the data
  • Loading branch information...
ndw committed May 19, 2012
1 parent c90e342 commit 5a71ee7995d7b62e6dce052fe9c0eefa11094223
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/com/xmlcalabash/extensions/Unzip.java
@@ -152,13 +152,18 @@ public void run() throws SaxonApiException {
XdmNode doc = runtime.parse(isource);
result.write(doc);
} else {
+ boolean storeText = (contentType != null && contentType.startsWith("text/") && charset != null);
+
tree.startDocument(step.getNode().getBaseURI());
tree.addStartElement(XProcConstants.c_data);
tree.addAttribute(_name,name);
tree.addAttribute(_content_type, contentType);
+ if (!storeText) {
+ tree.addAttribute(_encoding, "base64");
+ }
tree.startContent();
- if (contentType != null && contentType.startsWith("text/") && charset != null) {
+ if (storeText) {
InputStreamReader reader = new InputStreamReader(zipFile, charset);
int maxlen = 4096;
char[] chars = new char[maxlen];

0 comments on commit 5a71ee7

Please sign in to comment.