Logout

Alt-N Discussion Groups > MDaemon Discussion Groups > MDaemon API > xml API UTF8 German Letter

 [F] Alt-N Discussion Groups  / MDaemon Discussion Groups  / MDaemon API  /

xml API UTF8 German Letter

[Krauth, Daniel]
Daniel Krauth
Newbie
Newbie
Posts: 3
Daniel Krauth - 01:58am, Apr 23 2021

I am trying to add contacts to an address book and have problems with umlauts. Is this a bug in the version?

Regards Daniel

  (older msg: 4)All MessagesOldest ItemsOlder ItemsNewer ItemsNewest Items

Keith Personett (apparently) - Apr 28, 2021 8:10 am (#5 Total: 5)  

via email  

Photo of Author
Keith Personett
Newbie
Newbie
Posts: 76

Daniel,

 

It appears that you are likely double utf-8 encoding…

 

When I use the following JavaScript to create part of the request (within the Parameters Element) and post it to the XMLAPI (21.5 and 20.0.x are the same at this time) …

 

    function Test24809(objParamNode) {

 

      var szFolderClass = "IPF.Contact";

      var szType = "contact";

      var szFolderPath = "PUBLIC/nelson-murdock.int/Contacts";

 

      Status(szFolderPath + " : " + szFolderClass + "[" + szType + "]");

 

      var objNow = new Date();

      var szCID = objNow.getFullYear() + "-" + ZeroPad(objNow.getMonth(), 2) + "-" + ZeroPad(objNow.getDay(), 2) + "_" + ZeroPad(objNow.getHours(), 2) + ":" + ZeroPad(objNow.getMinutes(), 2) + ":" + ZeroPad(objNow.getSeconds(), 2) + ":" + ZeroPad(objNow.getMilliseconds(), 3) + "_" + RandomInteger(1000, 9999) + "." + RandomInteger(1000, 9999);

      Status("PUT: " + szFolderPath + "/" + szCID);

      this.objItemNode = objParamNode.appendChild(xmlReq.createElement("Item"));

      this.objItemNode.setAttribute("path", szFolderPath);

      this.objItemNode.setAttribute("action", "put");

      this.objItemNode.setAttribute("type", szType);

      this.objItemNode.setAttribute("cid", szCID);

 

      var szFirstName = "Steffen";

      var szLastName = "Grögor"; // The xmlhttp object will encode this as UTF-8

      var szEmail1Address = "s.groegor@intern.xyz.de";

 

      Status(szFirstName + " " + szLastName);

      this.objItemNode.appendChild(xmlReq.createElement("FirstName")).text = szFirstName;

      this.objItemNode.appendChild(xmlReq.createElement("LastName")).text = szLastName;

      this.objItemNode.appendChild(xmlReq.createElement("DisplayName")).text = (szFirstName + " " + szLastName);

      this.objItemNode.appendChild(xmlReq.createElement("FileAs")).text = (szLastName + ", " + szFirstName);

      this.objItemNode.appendChild(xmlReq.createElement("Email1Address")).text = szEmail1Address;

 

      return true;

    }

 

My script shows the following output…

 

07:50:34.422:ItemOperation:VERBOSE:BuildXML: 24809

07:50:34.422:ItemOperation:PUBLIC/nelson-murdock.int/Contacts : IPF.Contact[contact]

07:50:34.422:ItemOperation:PUT: PUBLIC/nelson-murdock.int/Contacts/2021-03-03_07:50:34:422_3013.7368

07:50:34.422:ItemOperation:Steffen Grögor

07:50:34.422:ItemOperation:undefined

07:50:34.422:ItemOperation:ItemOperation

07:50:34.578:ItemOperation:VERBOSE:__PostData: ResponseText: 1097 bytes

07:50:34.578:ItemOperation:VERBOSE:BaseProcessResponse:  id=0: 0x00000000:The operation completed successfully.

07:50:34.578:ItemOperation:1 <Item> elements returned

 

Tracing from the XML API shows…

 

07:50:34.515 I [4767ADEC] 0x4142002E Connection: 192.168.0.100 Server:api.nelson-murdock.int Method:POST SSL:1 User-Agent:Mgmt test script 2.0

07:50:34.515 I [4767ADEC] 0x41330008 Authenticated: **********************

07:50:34.515 I [4767ADEC] 0x4142005A Operation: ItemOperation

07:50:34.546 CItemJob::HrContactItemChange Grögor -> Grögor

07:50:34.562 I [4767ADEC] 0x41420030 Connection terminating

 

The resultant contact within PUBLIC/nelson-murdock.int/Contacts contains…

 

       <contact cid="2021-03-03_07:50:34:422_3013.7368" uid="{0a4beed4-baaa-4f41-bf1e-0af8ea50b179}" lastModified="2021-04-28T12:50:34.546Z" ID="0a4beed4baaa4f41bf1e0af8ea50b179">

              <guid>0a4beed4baaa4f41bf1e0af8ea50b179</guid>

              <modified>2021-04-28 12:50:34</modified>

              <firstName length="7"><![CDATA[Steffen]]></firstName>

              <lastName length="7"><![CDATA[Grögor]]></lastName>

              <fullName length="15"><![CDATA[Steffen Grögor]]></fullName>

              <fileAs length="16"><![CDATA[Grögor, Steffen]]></fileAs>

              <email length="23"><![CDATA[s.groegor@intern.xyz.de]]></email>

       </contact>

 

And the response xml from the API is as follows…

 

(Non-UTF-8 Encoded View)

 

<?xml version="1.0" encoding="utf-8"?>

<MDaemon>

       <API>

              <Request version="21.0.0" echo="1" verbose="0">

                     <Operation>ItemOperation</Operation>

                     <Parameters>

                           <Item path="PUBLIC/nelson-murdock.int/Contacts" action="put" type="contact" cid="2021-03-03_07:50:34:422_3013.7368">

                                  <FirstName>Steffen</FirstName>

                                  <LastName>Grögor</LastName>

                                  <DisplayName>Steffen Grögor</DisplayName>

                                  <FileAs>Grögor, Steffen</FileAs>

                                  <Email1Address>s.groegor@intern.xyz.de</Email1Address>

                           </Item>

                     </Parameters>

              </Request>

              <Response version="21.5" session="4767ADEC" et="0.051611">

                     <Status id="0" value="0x00000000" message="The operation completed successfully."/>

                     <ServiceVersion>21.5.0.1a</ServiceVersion>

                     <Result>

                           <Item cid="2021-03-03_07:50:34:422_3013.7368" action="put" path="PUBLIC/nelson-murdock.int/Contacts" ID="0a4beed4baaa4f41bf1e0af8ea50b179" lastModified="2021-04-28T12:50:34.546Z"/>

                           <Folder path="PUBLIC/nelson-murdock.int/Contacts" lastModified="2021-04-28T12:50:34.546Z"/>

                     </Result>

              </Response>

       </API>

</MDaemon>

 

(UTF-8 Encoded View)

 

<?xml version="1.0" encoding="utf-8"?>

<MDaemon>

       <API>

              <Request version="21.0.0" echo="1" verbose="0">

                     <Operation>ItemOperation</Operation>

                     <Parameters>

                           <Item path="PUBLIC/nelson-murdock.int/Contacts" action="put" type="contact" cid="2021-03-03_07:50:34:422_3013.7368">

                                  <FirstName>Steffen</FirstName>

                                  <LastName>Grögor</LastName>

                                  <DisplayName>Steffen Grögor</DisplayName>

                                  <FileAs>Grögor, Steffen</FileAs>

                                  <Email1Address>s.groegor@intern.xyz.de</Email1Address>

                           </Item>

                     </Parameters>

              </Request>

              <Response version="21.5" session="4767ADEC" et="0.051611">

                     <Status id="0" value="0x00000000" message="The operation completed successfully."/>

                     <ServiceVersion>21.5.0.1a</ServiceVersion>

                     <Result>

                           <Item cid="2021-03-03_07:50:34:422_3013.7368" action="put" path="PUBLIC/nelson-murdock.int/Contacts" ID="0a4beed4baaa4f41bf1e0af8ea50b179" lastModified="2021-04-28T12:50:34.546Z"/>

                           <Folder path="PUBLIC/nelson-murdock.int/Contacts" lastModified="2021-04-28T12:50:34.546Z"/>

                     </Result>

              </Response>

       </API>

</MDaemon>

 

 

Keith Personett

Senior Software Developer, Cerebro Calibration Specialist, Agent of S.H.I.E.LD., Helicarrier Systems Analyst

MDaemon Technologies http://www.mdaemon.com/ or on Facebook

Sent using Outlook 2013 via ActiveSync Services for MDaemon Messaging Server.

I 16 1018

"You get hurt, hurt 'em back. You get killed... walk it off!"

                - Steve Rogers/Captain America


--MD-API-------------------------------------------------------------
This list is for questions and discussions regarding MDAEMON's API.
To unsubscribe from this mailing list send an email to
md-api-unsubscribe@mdaemon.com .
--POWERED BY MDAEMON!------------------------------------------------

---------------------------------------------------------------------
These forums are provided by MDaemon Technologies for user-to-user
support and discussion.  MDaemon staff members may participate in the
forums periodically but please recognize that this is not the official
method of receiving technical support. To receive personal technical
support please use the form here:
http://www.mdaemon.com/support/request_support.asp
---------------------------------------------------------------------



  All MessagesOldest ItemsOlder ItemsNewer ItemsNewest Items



 Content:

Read New | Search

 Guest:

Email to Admin



You are visiting as a Guest user.