• JS error with IE

    By baio baio 2 decades ago

    hi,



    i try your product and it sounds good, but i found a problem using diff functionality. When you make a diff from 2 versions using IE ( 6 and 7 ) a Javascript error occur.

    Take a look at wiki.js, in function doXMLHTTPGet, when you make displayData(httpObj.responseXML). It seems that it's not a valid method for IE, it works only with FF.

    In fact in displayData function, xmlDoc.documentElement is null with IE but is an Element with FF.

    • Problem found

      By baio baio 2 decades ago

      i've found the problem.

      Was a question of illegal character pasted into page content. in this case responseXML wasn't loaded becose XML wasn't validated.



      Many thanks and sorry for the fake problem



      Andrea

      • But the problem exists...

        By baio baio 2 decades ago

        however i think that the problem exists….if you try to copy/paste into page some illegal character (like "è","à" etc.) and make a diff from versions, you can see it…

        While FF display these characters with a special one ("?"), IE doesn't work. I think that the problem would be resolved, maybe using XMLSerializer() ore something like that (i've found many posts over the web related to this)…



        Thanks in advance



        Andrea

        • One possible solution

          By baio baio 2 decades ago

          I've modified "Diff" agent into database, forcing output with XMLEncode function, somting like this:



          getNumberedLines( XmlEncode(docOld.GetItemValue(FLD_CONTENT)(0)))



          and i've extended the function "XMLEncode" into Script Library "GeneralFunctions" replacing "some" possible special characters (not all!!) in this way:


          Const AMPERSAND = &quot;&amp;amp;&quot;<br/>
          Const APOSTROPHE = &quot;&amp;apos;&quot;<br/>
          Const DBL_QUOTES = &quot;&amp;quot;&quot;<br/>
          Const GT = &quot;&amp;gt;&quot;<br/>
          Const LT = &quot;&amp;lt;&quot;<br/>
          Const INVERTED_EXCLAMATION_MARK = &quot;&amp;iexcl;&quot;<br/>
          Const CENT = &quot;&amp;cent&quot;<br/>
          Const POUND = &quot;&amp;pound;&quot;<br/>
          Const CURR = &quot;&amp;curren;&quot;<br/>
          Const YEN = &quot;&amp;yen;&quot;<br/>
          Const BROKEN_VERTICAL_MARK = &quot;&amp;brvbar;&quot;<br/>
          Const SECTION = &quot;&amp;sect;&quot;<br/>
          Const DIARESIS = &quot;&amp;uml;&quot;<br/>
          Const COPYRIGHT = &quot;&amp;copy;&quot;<br/>
          Const FEMININE_ORDINAL_INDICATOR = &quot;&amp;ordf;&quot;<br/>
          Const ANGLE_QUOTATION_MARK = &quot;&amp;laquo;&quot;<br/>
          Const NEGATION = &quot;&amp;not;&quot;<br/>
          Const SOFTHYPHEN = &quot;&amp;shy;&quot;<br/>
          Const REGISTERED_TRADE_MARK = &quot;&amp;reg;&quot;<br/>
          Const MACRON = &quot;&amp;macr;&quot;<br/>
          Const DEGREE = &quot;&amp;deg;&quot;<br/>
          Const PLUS_OR_MINUS = &quot;&amp;plusmn;&quot;<br/>
          Const SUPERSCRIPT_1 = &quot;&amp;sup1;&quot;<br/>
          Const SUPERSCRIPT_2 = &quot;&amp;sup2;&quot;<br/>
          Const SUPERSCRIPT_3 = &quot;&amp;sup3;&quot;<br/>
          Const ACUTE = &quot;&amp;acute;&quot;<br/>
          Const MICRO = &quot;&amp;micro;&quot;<br/>
          Const PARAGRAPH = &quot;&amp;para;&quot;<br/>
          Const MIDDLEDOT = &quot;&amp;middot;&quot;<br/>
          Const CEDILLA = &quot;&amp;cedil;&quot;<br/>
          Const MASCULINE_ORDINAL_INDICATOR = &quot;&amp;ordm;&quot;<br/>
          Const ANGLE_QUOTATION_MARK_RIGHT = &quot;&amp;raquo;&quot;<br/>
          Const FRACTION_14 = &quot;&amp;frac14;&quot;<br/>
          Const FRACTION_12 = &quot;&amp;frac12;&quot;<br/>
          Const FRACTION_34 = &quot;&amp;frac34;&quot;<br/>
          Const INVERTED_QUESTION_MARK = &quot;&amp;iquest;&quot;<br/>
          Const MULTIPLICATION = &quot;&amp;times;&quot;<br/>
          Const DIVISION = &quot;&amp;divide;&quot;<br/>
          Const CAPITAL_A_GRAVE_ACCENT = &quot;&amp;Agrave;&quot;<br/>
          Const CAPITAL_A_ACUTE_ACCENT = &quot;&amp;Aacute;&quot;<br/>
          Const CAPITAL_A_CIRCUMFLEX_ACCENT = &quot;&amp;Acirc;&quot;<br/>
          Const CAPITAL_A_TILDE = &quot;&amp;Atilde;&quot;<br/>
          Const CAPITAL_A_UMLAUT_MARK = &quot;&amp;Auml;&quot;<br/>
          Const CAPITAL_A_RING = &quot;&amp;Aring;&quot;<br/>
          Const CAPITAL_AE = &quot;&amp;AElig;&quot;<br/>
          Const CAPITAL_C_CEDILLA = &quot;&amp;Ccedil;&quot;<br/>
          Const CAPITAL_E_GRAVE_ACCENT = &quot;&amp;Egrave;&quot;<br/>
          Const CAPITAL_E_ACUTE_ACCENT = &quot;&amp;Eacute;&quot;<br/>
          Const CAPITAL_E_CIRCUMFLEX_ACCENT = &quot;&amp;Ecirc;&quot;<br/>
          Const CAPITAL_E_UMLAUT_MARK = &quot;&amp;Euml;&quot;<br/>
          Const CAPITAL_I_GRAVE_ACCENT = &quot;&amp;Igrave;&quot;<br/>
          Const CAPITAL_I_ACUTE_ACCENT = &quot;&amp;Iacute;&quot;<br/>
          Const CAPITAL_I_CIRCUMFLEX_ACCENT = &quot;&amp;Icirc;&quot;<br/>
          Const CAPITAL_I_UMLAUT_MARK = &quot;&amp;Iuml;&quot;<br/>
          Const CAPITAL_ETH_ICELANDIC = &quot;&amp;ETH;&quot;<br/>
          Const CAPITAL_N_TILDE = &quot;&amp;Ntilde;&quot;<br/>
          Const CAPITAL_O_GRAVE_ACCENT = &quot;&amp;Ograve;&quot;<br/>
          Const CAPITAL_O_ACUTE_ACCENT = &quot;&amp;Oacute;&quot;<br/>
          Const CAPITAL_O_CIRCUMFLEX_ACCENT = &quot;&amp;Ocirc;&quot;<br/>
          Const CAPITAL_O_TILDE = &quot;&amp;Otilde;&quot;<br/>
          Const CAPITAL_O_UMLAUT_MARK = &quot;&amp;Ouml;&quot;<br/>
          Const CAPITAL_O_SLASH = &quot;&amp;Oslash;&quot;<br/>
          Const CAPITAL_U_GRAVE_ACCENT = &quot;&amp;Ugrave;&quot;<br/>
          Const CAPITAL_U_ACUTE_ACCENT = &quot;&amp;Uacute;&quot;<br/>
          Const CAPITAL_U_CIRCUMFLEX_ACCENT = &quot;&amp;Ucirc;&quot;<br/>
          Const CAPITAL_U_UMLAUT_MARK = &quot;&amp;Uuml;&quot;<br/>
          Const CAPITAL_Y_ACUTE_ACCENT = &quot;&amp;Yacute;&quot;<br/>
          Const CAPITAL_THORN_ICELANDIC = &quot;&amp;THORN;&quot;<br/>
          Const SMALL_SHARP_S_GERMAN = &quot;&amp;szlig;&quot;    <br/>
          Const SMALL_A_GRAVE_ACCENT = &quot;&amp;agrave;&quot;<br/>
          Const SMALL_A_ACUTE_ACCENT = &quot;&amp;aacute;&quot;<br/>
          Const SMALL_A_CIRCUMFLEX_ACCENT = &quot;&amp;acirc;&quot;<br/>
          Const SMALL_A_TILDE = &quot;&amp;atilde;&quot;<br/>
          Const SMALL_A_UMLAUT_MARK = &quot;&amp;auml;&quot;<br/>
          Const SMALL_A_RING = &quot;&amp;aring;&quot;<br/>
          Const SMALL_AE = &quot;&amp;aElig;&quot;<br/>
          Const SMALL_C_CEDILLA = &quot;&amp;ccedil;&quot;<br/>
          Const SMALL_E_GRAVE_ACCENT = &quot;&amp;egrave;&quot;<br/>
          Const SMALL_E_ACUTE_ACCENT = &quot;&amp;eacute;&quot;<br/>
          Const SMALL_E_CIRCUMFLEX_ACCENT = &quot;&amp;ecirc;&quot;<br/>
          Const SMALL_E_UMLAUT_MARK = &quot;&amp;euml;&quot;<br/>
          Const SMALL_I_GRAVE_ACCENT = &quot;&amp;igrave;&quot;<br/>
          Const SMALL_I_ACUTE_ACCENT = &quot;&amp;iacute;&quot;<br/>
          Const SMALL_I_CIRCUMFLEX_ACCENT = &quot;&amp;icirc;&quot;<br/>
          Const SMALL_I_UMLAUT_MARK = &quot;&amp;iuml;&quot;  <br/>
          Const SMALL_ETH_ICELANDIC = &quot;&amp;eth;&quot;<br/>
          Const SMALL_N_TILDE = &quot;&amp;ntilde;&quot;<br/>
          Const SMALL_O_GRAVE_ACCENT = &quot;&amp;ograve;&quot;<br/>
          Const SMALL_O_ACUTE_ACCENT = &quot;&amp;oacute;&quot;<br/>
          Const SMALL_O_CIRCUMFLEX_ACCENT = &quot;&amp;ocirc;&quot;<br/>
          Const SMALL_O_TILDE = &quot;&amp;otilde;&quot;<br/>
          Const SMALL_O_UMLAUT_MARK = &quot;&amp;ouml;&quot;<br/>
          Const SMALL_O_SLASH = &quot;&amp;oslash;&quot;<br/>
          Const SMALL_U_GRAVE_ACCENT = &quot;&amp;ugrave;&quot;<br/>
          Const SMALL_U_ACUTE_ACCENT = &quot;&amp;uacute;&quot;<br/>
          Const SMALL_U_CIRCUMFLEX_ACCENT = &quot;&amp;ucirc;&quot;<br/>
          Const SMALL_U_UMLAUT_MARK = &quot;&amp;uuml;&quot;<br/>
          Const SMALL_Y_ACUTE_ACCENT = &quot;&amp;yacute;&quot;<br/>
          Const SMALL_Y_UMLAUT_MARK = &quot;&amp;yuml;&quot;<br/>
          Const SMALL_THORN_ICELANDIC = &quot;&amp;thorn;&quot;<br/>
          <br/>
          strReturn = Replace(data, {&amp;}, AMPERSAND)<br/>
          strReturn = Replace(strReturn, {'}, APOSTROPHE)<br/>
          strReturn = Replace(strReturn, {&lt;}, LT)<br/>
          strReturn = Replace(strReturn, {&gt;}, GT)<br/>
          strReturn = Replace(strReturn, {&quot;}, DBL_QUOTES)<br/>
          <br/>
          strReturn = Replace(strReturn, {¡}, INVERTED_EXCLAMATION_MARK)<br/>
          strReturn = Replace(strReturn, {¢}, CENT)<br/>
          strReturn = Replace(strReturn, {£}, POUND)<br/>
          strReturn = Replace(strReturn, {¤}, CURR)<br/>
          strReturn = Replace(strReturn, {¥}, YEN)<br/>
          strReturn = Replace(strReturn, {&brvbar;}, BROKEN_VERTICAL_MARK)<br/>
          strReturn = Replace(strReturn, {§}, SECTION)<br/>
          strReturn = Replace(strReturn, {¨}, DIARESIS)<br/>
          strReturn = Replace(strReturn, {©}, COPYRIGHT)<br/>
          strReturn = Replace(strReturn, {ª}, FEMININE_ORDINAL_INDICATOR)<br/>
          strReturn = Replace(strReturn, {«}, ANGLE_QUOTATION_MARK)<br/>
          strReturn = Replace(strReturn, {¬}, NEGATION)<br/>
          strReturn = Replace(strReturn, {­}, SOFTHYPHEN)<br/>
          strReturn = Replace(strReturn, {®}, REGISTERED_TRADE_MARK)<br/>
          strReturn = Replace(strReturn, {¯}, MACRON)<br/>
          strReturn = Replace(strReturn, {°}, DEGREE)<br/>
          strReturn = Replace(strReturn, {±}, PLUS_OR_MINUS)<br/>
          strReturn = Replace(strReturn, {¹}, SUPERSCRIPT_1)<br/>
          strReturn = Replace(strReturn, {²}, SUPERSCRIPT_2)<br/>
          strReturn = Replace(strReturn, {³}, SUPERSCRIPT_3)<br/>
          strReturn = Replace(strReturn, {´}, ACUTE)<br/>
          strReturn = Replace(strReturn, {µ}, MICRO)<br/>
          strReturn = Replace(strReturn, {¶}, PARAGRAPH)<br/>
          strReturn = Replace(strReturn, {·}, MIDDLEDOT)  <br/>
          strReturn = Replace(strReturn, {¸}, CEDILLA)<br/>
          strReturn = Replace(strReturn, {º}, MASCULINE_ORDINAL_INDICATOR)<br/>
          strReturn = Replace(strReturn, {»}, ANGLE_QUOTATION_MARK_RIGHT)<br/>
          strReturn = Replace(strReturn, {¼}, FRACTION_14)<br/>
          strReturn = Replace(strReturn, {½}, FRACTION_12)<br/>
          strReturn = Replace(strReturn, {¾}, FRACTION_34)<br/>
          strReturn = Replace(strReturn, {¿}, INVERTED_QUESTION_MARK)<br/>
          strReturn = Replace(strReturn, {×}, MULTIPLICATION)<br/>
          strReturn = Replace(strReturn, {÷}, DIVISION)<br/>
          strReturn = Replace(strReturn, {À}, CAPITAL_A_GRAVE_ACCENT)<br/>
          strReturn = Replace(strReturn, {Á}, CAPITAL_A_ACUTE_ACCENT)<br/>
          strReturn = Replace(strReturn, {Â}, CAPITAL_A_CIRCUMFLEX_ACCENT)<br/>
          strReturn = Replace(strReturn, {Ã}, CAPITAL_A_TILDE)<br/>
          strReturn = Replace(strReturn, {Ä}, CAPITAL_A_UMLAUT_MARK)<br/>
          strReturn = Replace(strReturn, {Å}, CAPITAL_A_RING)<br/>
          strReturn = Replace(strReturn, {Æ}, CAPITAL_AE)<br/>
          strReturn = Replace(strReturn, {Ç}, CAPITAL_C_CEDILLA)<br/>
          strReturn = Replace(strReturn, {È}, CAPITAL_E_GRAVE_ACCENT)<br/>
          strReturn = Replace(strReturn, {É}, CAPITAL_E_ACUTE_ACCENT)<br/>
          strReturn = Replace(strReturn, {Ê}, CAPITAL_E_CIRCUMFLEX_ACCENT)<br/>
          strReturn = Replace(strReturn, {Ë}, CAPITAL_E_UMLAUT_MARK)<br/>
          strReturn = Replace(strReturn, {Ì}, CAPITAL_I_GRAVE_ACCENT)<br/>
          strReturn = Replace(strReturn, {Í}, CAPITAL_I_ACUTE_ACCENT)<br/>
          strReturn = Replace(strReturn, {Î}, CAPITAL_I_CIRCUMFLEX_ACCENT)<br/>
          strReturn = Replace(strReturn, {Ï}, CAPITAL_I_UMLAUT_MARK)<br/>
          strReturn = Replace(strReturn, {Ð}, CAPITAL_ETH_ICELANDIC)<br/>
          strReturn = Replace(strReturn, {Ñ}, CAPITAL_N_TILDE)<br/>
          strReturn = Replace(strReturn, {Ò}, CAPITAL_O_GRAVE_ACCENT)<br/>
          strReturn = Replace(strReturn, {Ó}, CAPITAL_O_ACUTE_ACCENT)<br/>
          strReturn = Replace(strReturn, {Ô}, CAPITAL_O_CIRCUMFLEX_ACCENT)<br/>
          strReturn = Replace(strReturn, {Õ}, CAPITAL_O_TILDE)<br/>
          strReturn = Replace(strReturn, {Ö}, CAPITAL_O_UMLAUT_MARK)<br/>
          strReturn = Replace(strReturn, {Ø}, CAPITAL_O_SLASH)<br/>
          strReturn = Replace(strReturn, {Ù}, CAPITAL_U_GRAVE_ACCENT)<br/>
          strReturn = Replace(strReturn, {Ú}, CAPITAL_U_ACUTE_ACCENT)<br/>
          strReturn = Replace(strReturn, {Û}, CAPITAL_U_CIRCUMFLEX_ACCENT)<br/>
          strReturn = Replace(strReturn, {Ü}, CAPITAL_U_UMLAUT_MARK)<br/>
          strReturn = Replace(strReturn, {Ý}, CAPITAL_Y_ACUTE_ACCENT)<br/>
          strReturn = Replace(strReturn, {Þ}, CAPITAL_THORN_ICELANDIC)<br/>
          strReturn = Replace(strReturn, {ß}, SMALL_SHARP_S_GERMAN)<br/>
          strReturn = Replace(strReturn, {à}, SMALL_A_GRAVE_ACCENT)<br/>
          strReturn = Replace(strReturn, {á}, SMALL_A_ACUTE_ACCENT)<br/>
          strReturn = Replace(strReturn, {â}, SMALL_A_CIRCUMFLEX_ACCENT)<br/>
          strReturn = Replace(strReturn, {ã}, SMALL_A_TILDE)<br/>
          strReturn = Replace(strReturn, {ä}, SMALL_A_UMLAUT_MARK)<br/>
          strReturn = Replace(strReturn, {å}, SMALL_A_RING)<br/>
          strReturn = Replace(strReturn, {æ}, SMALL_AE)<br/>
          strReturn = Replace(strReturn, {ç}, SMALL_C_CEDILLA)<br/>
          strReturn = Replace(strReturn, {è}, SMALL_E_GRAVE_ACCENT)<br/>
          strReturn = Replace(strReturn, {é}, SMALL_E_ACUTE_ACCENT)<br/>
          strReturn = Replace(strReturn, {ê}, SMALL_E_CIRCUMFLEX_ACCENT)<br/>
          strReturn = Replace(strReturn, {ë}, SMALL_E_UMLAUT_MARK)<br/>
          strReturn = Replace(strReturn, {ì}, SMALL_I_GRAVE_ACCENT)<br/>
          strReturn = Replace(strReturn, {í}, SMALL_I_ACUTE_ACCENT)<br/>
          strReturn = Replace(strReturn, {î}, SMALL_I_CIRCUMFLEX_ACCENT)<br/>
          strReturn = Replace(strReturn, {ï}, SMALL_I_UMLAUT_MARK)<br/>
          strReturn = Replace(strReturn, {ð}, SMALL_ETH_ICELANDIC)<br/>
          strReturn = Replace(strReturn, {ñ}, SMALL_N_TILDE)<br/>
          strReturn = Replace(strReturn, {ò}, SMALL_O_GRAVE_ACCENT)<br/>
          strReturn = Replace(strReturn, {ó}, SMALL_O_ACUTE_ACCENT)<br/>
          strReturn = Replace(strReturn, {ô}, SMALL_O_CIRCUMFLEX_ACCENT)<br/>
          strReturn = Replace(strReturn, {õ}, SMALL_O_TILDE )<br/>
          strReturn = Replace(strReturn, {ö}, SMALL_O_UMLAUT_MARK)<br/>
          strReturn = Replace(strReturn, {ø}, SMALL_O_SLASH)<br/>
          strReturn = Replace(strReturn, {ù}, SMALL_U_GRAVE_ACCENT)<br/>
          strReturn = Replace(strReturn, {ú}, SMALL_U_ACUTE_ACCENT)<br/>
          strReturn = Replace(strReturn, {û}, SMALL_U_CIRCUMFLEX_ACCENT)<br/>
          strReturn = Replace(strReturn, {ü}, SMALL_U_UMLAUT_MARK)<br/>
          strReturn = Replace(strReturn, {ý},  SMALL_Y_ACUTE_ACCENT)<br/>
          strReturn = Replace(strReturn, {ÿ}, SMALL_Y_UMLAUT_MARK )<br/>
          strReturn = Replace(strReturn, {þ}, SMALL_THORN_ICELANDIC)<br/>
          <br/>
          XmlEncode = strReturn<br/>
          





          Then, in wiki.js, i force the unescape of string that i get out, in this way:



          document.getElementById("diff").innerHTML = unescape(strHTML);



          now it works!



          It's enough for me, but i thing that it will be extended again. Any other solution will be appreciated



          Thanks



          Andrea