Posts tagged "characters"

Acrobat/Reader: Some special characters are not escaped in XML submission to a HTTP URL

Issue

If you are using XFA forms to submit/export data in XML format from Acrobat/Reader, you may notice that some of the special characters (<>”&’) are not being escaped in the XML output. This can lead to problems if this XML is then to be parsed server-side or used by custom applications.

Explanation

The XML data submitted/exported from Acrobat/Reader escapes characters like & (ampersand) > (greater than) and < (less than), but not ” (quote) or ‘ (apostrophe).  Custom applications may encounter problems when trying to parse XML data containing apostrophe or quote characters, if they are expecting these characters to be escaped like for <, > and &.

There are 5 predefined entity references in XML (http://www.w3schools.com/xml/xml_syntax.asp):

&lt;  < less than
&gt;  > greater than
&amp;  & ampersand
&apos;  ‘ apostrophe
&quot;  “ quotation mark

Note: Only the characters “<” and “&” are strictly illegal in XML. The greater than character is legal, but it is a good habit to replace it.

So the XML specification recommends to replace only “<“, “&” and “>”.  It does not require quote and apostrophe characters to be escaped for element values.  Therefore all conformant XML parsers should be able to handle this.

Quotes and apostrophes only need to be escaped if they occur in an attribute value surrounded by the same single or double-quote character.  In this case, Acrobat/Reader will escape the quote or apostrophe characters as required.

Notes:

You can use a regular button with script like “event.target.submitForm({cURL: url, cSubmitAs:”XML”});” to submit data in XML format to a specific URL.

reference: (182809204/3054499)

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 6.3/10 (4 votes cast)

LiveCycle Forms7: importXMP() throws a PDFOperationFailure if the data contains accented characters

Issue

 If you are using the importXMP() method from the FormServer 7 API to import XMP metadata to a PDF you may receive a PDFOperationFailure exception in the log similar to the following:

[11.07.06 13:55:50:837 CEST] 16fd9246 SystemErr R omniORB: WARNING --method 'importXMP' 
on: root/req-66<16777216> raised the exception: IDL:com/adobe/document/pdf/PDFOperationFailure:1.0
[11.07.06 13:55:50:838 CEST] 31281245 SystemErr R
org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x0 minor code: 0 completed: Maybe
[11.07.06 13:55:50:838 CEST] 31281245 SystemErr R 
atcom.ibm.ws.Transaction.JTS.TxClientInterceptor.receive_reply(TxClientInterceptor.java:213)
[11.07.06 13:55:50:838 CEST] 31281245 SystemErr R

Reason

This exception is caused by accented characters in the XMP metadata.  Removing the accented characters will allow the importXMP() to complete successfully, so there is obviously a problem with the encoding.

Solution

 You may be using the following code to generate the data:

lvFileW.write(sb.toString().getBytes());

To resolve the issue you must set the encoding to UTF-8 if there are accented characters:

lvFileW.write(sb.toString().getBytes("UTF-8"));

__________________________________
reference: (1-27943601)

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 0.0/10 (0 votes cast)