zaus / forms-3rdparty-xpost

Converts external submission from [Forms: 3rdparty Integration](http://wordpress.org/plugins/forms-3rdparty-integration/) plugin to XML post; optionally can add custom headers (to allow SOAP submissions).
4 stars 2 forks source link

Encoded string #26

Open liorfein opened 7 years ago

liorfein commented 7 years ago

I entered hebrew characters text in the form. But the created XML contains encoded string instead of the original input

<ROOT><PERMISSION><USERNAME>API</USERNAME><PASSWORD>1234</PASSWORD></PERMISSION><CUST_DETAILS><P_N>&#x5D1;&#x5D3;&#x5D9;&#x5E7;&#x5D4;</P_N><CELL>0521234567</CELL><MAIL>test1@test.com</MAIL><CAMPAIGN>&#x5D8;&#x5D5;&#x5E4;&#x5E1; &#x5D1;&#x5D0;&#x5EA;&#x5E8;</CAMPAIGN></CUST_DETAILS><CARD_TYPE>private_customer</CARD_TYPE></ROOT>

(in the preview of this issue, the XML is displayed correctly after decoding):

API1234בדיקה0521234567test1@test.comטופס באתרprivate_customer
zaus commented 7 years ago

Sidenote: use formatting -- wrapping the XML with the "code" indicators (`) will show what you meant; I updated your post accordingly.

How does the original submission look? Meaning, is it encoded coming back from the form? Or only after it's mapped to XML? How are you mapping -- nested fields or mask? It'd probably help to include the entire debug email (scrubbed of sensitive data).

liorfein commented 7 years ago

Hi

According to the debug mail it seems that the the original value was received and the encoding happened after the mapping. (see attached file) I am mapping nested fields like CUST_DETAILS/P_N (I tested also without nesting the field but same problem occurs) No mask

Thank you

3rd party x-post debug.txt

liorfein commented 7 years ago

Hi I think my problem is a result that the created XML does not have encoding="UTF-8" in the Header. A suggested code change is to add in function simple_xmlify ' $root = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?>' . $el);' instead of ' $root = new SimpleXMLElement($el);'

(added xml version=1.0 encoding=UTF-8 to argument)