MOD Lors d'une erreur lors d'en envoie de message le message n'est plus enlevé de...
[euphorik.git] / js / euphorik.js
index 9dd3357..e56acde 100755 (executable)
@@ -128,7 +128,11 @@ Util.prototype.creerDocumentXMLAction = function()
 {\r
    if (document.implementation && document.implementation.createDocument)\r
    {\r
-      return document.implementation.createDocument("", "action", null)\r
+      // var doc = document.implementation.createDocument("", "action", null)
+      var parser = new DOMParser();
+      var doc =  parser.parseFromString("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<action/>", "text/xml")
+      //alert(this.serializeXML(doc))
+      return doc\r
    }\r
    else if (window.ActiveXObject)\r
    {\r
@@ -143,32 +147,9 @@ Util.prototype.creerDocumentXMLAction = function()
 
 Util.prototype.xmlVersAction = function(xml)
 {
-   return {action: this.to_utf8(this.serializeXML(xml /*, "UTF-8"*/))}
+   //return {action: this.to_utf8(this.serializeXML(xml /*, "UTF-8"*/))}
+   return {action: this.serializeXML(xml)}
 }
-
-// voir : http://homepage3.nifty.com/aokura/jscript/utf8.html
-// et : http://www1.tip.nl/~t876506/utf8tbl.html
-Util.prototype.to_utf8 = function(s)
-{\r
-   if (!s) return ""\r
-
-   var c, d = ""
-   for (var i = 0; i < s.length; i++)
-   {
-      c = s.charCodeAt(i);
-      if (c <= 0x7f) {
-         d += s.charAt(i);
-      } else if (c >= 0x80 && c <= 0x7ff) {
-         d += String.fromCharCode(((c >> 6) & 0x1f) | 0xc0);
-         d += String.fromCharCode((c & 0x3f) | 0x80);
-      } else {
-         d += String.fromCharCode((c >> 12) | 0xe0);
-         d += String.fromCharCode(((c >> 6) & 0x3f) | 0x80);
-         d += String.fromCharCode((c & 0x3f) | 0x80);
-      }
-   }
-   return d;
-}\r
 \r
 Util.prototype.md5 = function(chaine)\r
 {\r
@@ -775,6 +756,12 @@ jQuery.noConflict()
 jQuery(document).ready(
    function()
    {  
+      /* FIXME : ce code pose problème sur konqueror, voir : http://www.kde-forum.org/thread.php?threadid=17993
+      var p = new DOMParser();
+      var doc =  p.parseFromString("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<action/>", "text/xml")
+      var s = new XMLSerializer()
+      alert(s.serializeToString(doc)) */
+   
       var util = new Util()
       var client = new Client(util)
       var pages = new Pages()