SDK End of line characters removed for MHT and XLWA output

Technote (FAQ)


Question

How can the proposed solutions be implemented?

Cause

When the bibus » outputEncapsulationEnum enumeration set is set to none and MHT or XLWA is specified, the end of line character sequence, Carriage Return (#13) and Line Feed (#10), is normalized into a single Line Feed (#10) character within the encapsulated XML document, leaving only the Line Feed character. Many Microsoft Windows applications cannot process these formats without the full end of line character sequence

If you are specifing either of these formats in this manner for report output, you should employ one of the following methods to correct the XML output:
.
Introduce a post-processing step in your SDK application to replace all instances of LF characters with CRLF.
.
Set the value of the RSVP.ATTACHMENTENCODING.BASE64EXTENDED advanced setting to true. This results in MHT and XLWA output to be base64 encoded. Your application would then need to decode the output appropriately before use.

NOTE: for 10.2, only method 1 can be used. RSVP.ATTACHMENTENCODING.BASE64EXTENDED was implemented in 10.2.1.


Answer

The following snippets of code are written from the context of the C:\ibm\cognos\c10.2.1_64\sdk\java\runreport\reportrunner.java sample code:


Method 1: replace LF with CRLF
...
for (int idx = 0; idx < data.length; idx++)
{
String fixed_hunk =
replaceSubstring(data[idx], "../", uriFix);
fixed_hunk =
replaceSubstring(fixed_hunk, "\n", "\r\n"); // replace LF with CRLF
fs.write(fixed_hunk.getBytes());
}
...

Method 2: using RSVP.ATTACHMENTENCODING.BASE64EXTENDED advanced setting is set to true
...
import org.apache.axis.encoding.Base64;
...
for (int idx = 0; idx < data.length; idx++)
{
data[idx] = new String(Base64.decode(data[idx])); // decode the XLWA/MHT output when RSVP.ATTACHMENTENCODING.BASE64EXTENDED advanced setting is set to true.
String fixed_hunk =
replaceSubstring(data[idx], "../", uriFix);
fs.write(fixed_hunk.getBytes());
}
...


Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Cognos Business Intelligence
Software Development Kit

Software version:

10.2, 10.2.1

Operating system(s):

AIX, HP Itanium, HP-UX, Linux, Solaris, Windows

Reference #:

1642928

Modified date:

2013-07-16

Translate my page

Machine Translation

Content navigation