AutoResponse UTF8 | MDaemon Technologies, Ltd.

AutoResponse UTF8


  • I'm performing an UpdateUser and updating the Auto Responder through the API. How can I make the text in 'Response' support UTF-8? In the Spanish language, there are accented characters that appear as strange characters.

    <MDaemon>
    <API productversion="22.5.0" serviceversion="22.5.0.1">
    <Request version="22.5" echo="1" verbose="0">
    <Operation>UpdateUser</Operation>
    <Parameters>
    <Domain>comm.es</Domain>
    <Mailbox>jmeilan</Mailbox>
    <AutoResponder>
    <Enabled>Yes</Enabled>
                <Start>2023-08-18T13:00:00.000Z</Start>
                <End>2023-08-27T21:00:00.000Z</End>
                <Response><![CDATA[Hola, estaré fuera de la oficina
     
    Un saludo, 
    JM
     
    Este correo es automático no hace falta que respondas. 
     
     
    ---------------------------------------------------------------------------
     
    Hello, I will be out of the office
     
    Best regards,
    JM
     
    This email is automatic, you do not need to reply.
     
     
     
     
    ]]></Response>
                <DaysActive mask="0x7F"></DaysActive>
    </AutoResponder>
    </Parameters>
    </Request>
    </API>
    </MDaemon>


  • Converting text to UTF-8 is pretty much a language specific task.

    For instance...

    In C under Windows, you could use MultiByteToWideChar and WideCharToMultiByte...

    In C#, you could use The Encoding.Default and Encoding.UTF8 objects

    In J[ava]Script, there area bunch of ways... You could check out https://snippets.snyk.io/javascript/javascript-convert-string-to-utf-8

    In PowerShell, check out the [System.Text.Encoding] object...


  • Hi @Keith Personett,  I have a small C# function that converts text to UTF-8. The problem I'm encountering is as follows: when I make a GetUserInfo request, the response is returned to me in Unicode format. I don't have any problem converting it, but when I make an UpdateUser request, UTF-8 encoding is not respected, and strange characters are being recorded in the server. 

    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                               "<MDaemon>" +
                                       "<API serviceversion=\"22.5.0.1\" productversion=\"22.5.0\">" +
                                            "<Request verbose=\"0\" echo=\"1\" version=\"22.5\">" +
                                                   "<Operation>UpdateUser</Operation>" +
                                                       "<Parameters>" +
                                                             "<Domain>commcenter.es</Domain>" +
                                                                   "<Mailbox>" + userEmail + "</Mailbox>" +
                                                            "<AutoResponder>" +
                                                                "<Enabled>true</Enabled>" +
                                                                "<Start>" + startDate + "</Start>" +
                                                                "<End>" + endDate + "</End>" +
                                                                "<Response>" + utf8Convert(autoResponse) + "</Response>" +
                                                                "<DaysActive mask = \"0x7F\" />" +
                                                                "</AutoResponder>" +
                                                        "</Parameters>" +
                                            "</Request>" +
                                       "</API>" +
                                 "</MDaemon>";

    While integrating into our intranet, I noticed something. When you try to change the autoresponse, but it's not allowed due to having a template, the server returns a message that the operation was completed successfully. The server no record this action because the template prevents it. Up to this point, everything is correct. But shouldn't the message returned by the API be different, "The operation to change the autoresponse could not be completed due to a template restriction.

     

     


  • Javier, regarding the encoding, I'll have to run some tests on this to determine what the issue is.

    As far as the template over-riding the Auto Response message, unfortuanately, the MDUser.dll function 'MD_SetAutoRespInfo' does not appear to take the template into consideration. I'll have to add some specialized code to inform that while the data was updated on disk, the value would be over-ridden by the template.


  • There is no problem, with the tests you carry out please inform me, to continue with the project. I will continue testing


  • @Keith 

    Hello,

    Do you have and and update concerning this issue, it does occur when we use the API function, even when we don’t send the response text in the XML file.

    The default autoresponder text is change and the accents are not readable.

    Here is the cli we use:
    curl -i -X POST \ -u test.user:XXXX PWD PWD PWD  XXXXXXXXX \ -H "Content-Type: text/xml" \ -d @test.xml \ http://192.168.5.104:1000/MdMgmtWS

    Default oof text

    After using the API

    Best regards,

    Elio


  • I've been swamped with other work items as of late and was on vacation last week. I am testing this today and will see if I can reproduce the issue you are seeing. If so, I will be developing a fix.


  • With this request, I see that it is storing the OOF.Mrk properly as UTF-8...

    <?xml version="1.0" encoding="utf-8"?>
    <MDaemon>
    	<API productversion="24.0.0" serviceversion="24.0.0.1">
    		<Request version="23.5" echo="1" verbose="0">
    			<Operation>UpdateUser</Operation>
    			<Parameters>
    				<Domain>f4.int</Domain>
    				<Mailbox>Human.Torch</Mailbox>
    				<AutoResponder>
    					<Enabled>Yes</Enabled>
    					<Start>2023-12-12T09:00:00.000Z</Start>
    					<End>2024-01-20T20:00:00.000Z</End>
    					<Response>Tapibaun kyblube Human.Torch.Owouhup . Hola, estaré fuera de la oficin. obsiaga masotifubl isapisyvio mejokei nofi,  aubu,  voipymy sopejoj bebamein viwoofibs voati.Wagywa gipomio haihagitytoabsy webraib rynif yruniviogain eejumaimiafoman . Este correo es automático no hace falta que respondas. oatydeisavaig chycau oufom.</Response>
    					<DaysActive mask="0xe">
    						<Monday/>
    						<Tuesday/>
    						<Wednesday/>
    					</DaysActive>
    				</AutoResponder>
    			</Parameters>
    		</Request>
    		<Response version="24.0" et="0.106034">
    			<Status id="0" value="0x00000000" message="The operation completed successfully."/>
    		</Response>
    	</API>
    </MDaemon>
    

     

    Here is the resultant OOF.Mrk file...

    Tapibaun kyblube Human.Torch.Owouhup . Hola, estaré fuera de la oficin. obsiaga masotifubl isapisyvio mejokei nofi,  aubu,  voipymy sopejoj bebamein viwoofibs voati.Wagywa gipomio haihagitytoabsy webraib rynif yruniviogain eejumaimiafoman . Este correo es automático no hace falta que respondas. oatydeisavaig chycau oufom.

    When I request the Auto Responder data after that update, it appears to render it to the client properly...

    <?xml version="1.0" encoding="utf-8"?>
    <MDaemon>
    	<API productversion="24.0.0" serviceversion="24.0.0.1">
    		<Request version="23.5" echo="1" verbose="0">
    			<Operation>GetUserInfo</Operation>
    			<Parameters>
    				<Domain>f4.int</Domain>
    				<Mailbox>Human.Torch</Mailbox>
    				<Get>
    					<AutoResponder/>
    				</Get>
    			</Parameters>
    		</Request>
    		<Response version="24.0" et="0.032787">
    			<Status id="0" value="0x00000000" message="The operation completed successfully."/>
    			<Result>
    				<User id="Human.Torch" displayname="The Human Torch" domain="f4.int">
    					<AutoResponder>
    						<Enabled>Yes</Enabled>
    						<Start>2023-12-12T09:00:00.000Z</Start>
    						<End>2024-01-20T20:00:00.000Z</End>
    						<Response><![CDATA[Tapibaun kyblube Human.Torch.Owouhup . Hola, estaré fuera de la oficin. obsiaga masotifubl isapisyvio mejokei nofi,  aubu,  voipymy sopejoj bebamein viwoofibs voati.Wagywa gipomio haihagitytoabsy webraib rynif yruniviogain eejumaimiafoman . Este correo es automático no hace falta que respondas. oatydeisavaig chycau oufom.]]></Response>
    						<DaysActive mask="0x07">
    							<Monday/>
    							<Tuesday/>
    							<Wednesday/>
    						</DaysActive>
    					</AutoResponder>
    				</User>
    			</Result>
    		</Response>
    	</API>
    </MDaemon>
    

     

    If I submit an update request without an AutoResponser/Response element, it does update the OOF.Mrk file because itloads it into member prior to the update being applied so that current values are represented correctly if not specified in the update request. It re-saves it at thiat time, identical to what was already on disk.

    I do know that the MD UI does not handle UTF-8 text correctly in most cases, so that may explain the presentation in the MD UI. For instance, in the case of my test, the MD UI presents the Response data as follows...

    Tapibaun kyblube Human.Torch.Owouhup . Hola, estaré fuera de la oficin. obsiaga masotifubl isapisyvio mejokei nofi,  aubu,  voipymy sopejoj bebamein viwoofibs voati.Wagywa gipomio haihagitytoabsy webraib rynif yruniviogain eejumaimiafoman . Este correo es automático no hace falta que respondas. oatydeisavaig chycau oufom.

    I did notice that the AutoResponse Reply message generated when email is received does not specify UTF-8, but instead 'iso-8859-1'. That may be an issue here...


  • Hi @Keith 

    I have reviewed your example, and I have tested it on the latest version, 23.5. After replicating your example, the file OOF.mrk is not stored in UTF-8. The version loaded on the server is 'Management Web Service (64-bit) (MDMgmtWS.dll): 23.5.0.2.'

     

    Request:
    <?xml version="1.0" encoding="utf-8"?>
    <MDaemon>
     <API productversion="24.0.0" serviceversion="24.0.0.1">
      <Request version="23.5" echo="1" verbose="0">
       <Operation>UpdateUser</Operation>
       <Parameters>
      <Domain>comm.es</Domain>
        <Mailbox>testingAPI</Mailbox>
        <AutoResponder>
         <Enabled>Yes</Enabled>
         <Start>2023-12-12T09:00:00.000Z</Start>
         <End>2024-01-20T20:00:00.000Z</End>
         <Response> España Tapibaun kyblube Human.Torch.Owouhup . Hola, estaré fuera de la oficin. obsiaga masotifubl isapisyvio mejokei nofi,  aubu,  voipymy sopejoj bebamein viwoofibs voati.Wagywa gipomio haihagitytoabsy webraib rynif yruniviogain eejumaimiafoman . Este correo es automático no hace falta que respondas. oatydeisavaig chycau oufom.</Response>
         <DaysActive mask="0xe">
          <Monday/>
          <Tuesday/>
          <Wednesday/>
         </DaysActive>
        </AutoResponder>
       </Parameters>
      </Request>
     </API>
    </MDaemon>

    Result in OOF.mrk

    If we send an email, the response does not come in UTF-8 format.

    Something is not working properly.

    Thank you for your time.

     


  • Javier, I've found an issue... OOF.Mrk requires a UTF-8 BOM header in it. I'm making that change to the 23.5.1 ßeta this morning.


  • Javier, my hope is that the fix will be in MdMgmtWS.dll 23.5.1.5 and later. It is a very small, very low risk fix, so I see no reason that it will not make it into the next ßeta release, but that is not my decision to make.


  • It should be noted that you can also use the %SetSubject%= macro in the Response body.

     

    ie.

    Hola, $SENDER$, estaré fuera de la oficin.

    Este correo es automático no hace falta que respondas. Ydrofo butoafypifea Human.Torch!

    $RECIPIENT$

    %SetSubject%=OOF: $SUBJECT$


Please login to reply this topic!