Showing results 1 to 2 of 2

Thread: XML utf-8

  1. #1
    Join Date
    12.10.2016
    Posts
    6

    Default XML utf-8

    In a project i read some information from a xml file with zenon logic.
    I haven't got problem.

    I need to translate my project in chiness, and i have some problem with convertion.

    this my xml file
    <?xml version="1.0" encoding="utf-8"?>
    <DESCRIPTION><TITLE>0-与PLC连接不工作</TITLE><MODULE>@GENERAL</MODULE><DIAGNOSIS>Qiyun : PLC不工作\n网络故障\nJie : 检查PCL供电\n检查网络布线\n检查HMI网络配置</DIAGNOSIS><TIMELEFT></TIMELEFT><DOC>C:\GCX\ROBOACCESS\RT\FILES\zenon\cus tom\additional\GCX\DOC\ALARMS\ZH\0.html</DOC><MEDIA></MEDIA><OCCURENCE></OCCURENCE><MODULE>1</MODULE></DESCRIPTION>
    when i read the TITLE i have in return in a string:

    0-与PLC连接不工作
    this is my zenon code
            XMLS := _APP_FOLDER + 'RT\FILES\zenon\custom\additional\GCX\DOC\ALARMS\' + sys_lang_initial + '\ALARM_ID_' + RIGHT(_SelectedObjectId, len(_SelectedObjectId) -1 ) + '.xml';
            hTag2 := XmlParseDocFile(XMLS);
            //(hTag2);
            xmllasterrord := XmlLastError();
            xml_tag_parent := XmlGetParent( hTag2 );
            xmllasterrord := XmlLastError();
            xml_hchild_tag := XmlFirstChild(hTag2,'');
            xmllasterrord := XmlLastError();
            tt := XmlGetTagName(xml_hchild_tag);
            //title
            XmlGetTagCont(xml_hchild_tag,TTT);
            ALARM_DESC_TITLES := TTT;
            //MODULE
            xml_hchild_tag := XmlNextChild(hTag2,xml_hchild_tag,'');
            XmlGetTagCont(xml_hchild_tag,TTT);
            ALARM_DESC_SUBTITLES := TTT;
            //DIAGNOSIS
            xml_hchild_tag := XmlNextChild(hTag2,xml_hchild_tag,'');
            XmlGetTagCont(xml_hchild_tag,TTT);
            ALARM_DESC_DIAGNOSIS := TTT;
            //TIMELEFT
            xml_hchild_tag := XmlNextChild(hTag2,xml_hchild_tag,'');
            XmlGetTagCont(xml_hchild_tag,TTT);
            ALARM_DESC_TIMELEFT := TTT;
            //DOC
            xml_hchild_tag := XmlNextChild(hTag2,xml_hchild_tag,'');
            XmlGetTagCont(xml_hchild_tag,TTT);
            ALARM_OPL_PATH := TTT;
            //MEDIA
            xml_hchild_tag := XmlNextChild(hTag2,xml_hchild_tag,'');
            XmlGetTagCont(xml_hchild_tag,TTT);
            ALARM_MEDIA_PATH := TTT;
            //OCCURENCE
            xml_hchild_tag := XmlNextChild(hTag2,xml_hchild_tag,'');
    //        ALARM_DESC_TITLES := TTT;
            //MODULE
            xml_hchild_tag := XmlNextChild(hTag2,xml_hchild_tag,'');
            XmlGetTagCont(xml_hchild_tag,TTT);
            ALARM_DESC_MODULE_NUM := any_to_int(TTT);
            XmlFreeDoc( hTag2 );

    They have a solution?



  2. #2
    Join Date
    23.10.2018
    Posts
    12

    Default Re: XML utf-8

    Hi Johann,

    The problem comes from the fact straton/zenon-Logic is not coded in Unicode.
    Then, using special characters, few things may not work, like what you observe here.

    The solution is often to really use a specific OS (Korean or Chinese OS for example).
    Anyway, if this can solve most of this kind of errors, it does not work 100% of the time.

    Re-encoding all of the straton/zenon-Logic product in Unicode is on our tasklist, but
    Unfortunately it cannot be done quickly as it means re-doing almost everything from the beginning!

    I hope with a Chinese OS you will manage to reach your goal.
    (Otherwise, we could try to find another solution, but for the moment nothing comes to my mind, sorry)

    Best regards,
    Anthony

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •