Changeset 261


Ignore:
Timestamp:
07/16/05 23:36:48 (9 years ago)
Author:
gogo
Message:

Fix for #167 - 8bit characters causing problems in links. You may turn
off this fix with config.only7BitPrintablesInURLs = false;

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/htmlarea.js

    r260 r261  
    245245  //  that don't have a url prefixing them 
    246246  this.stripSelfNamedAnchors = true; 
     247 
     248  // sometimes high-ascii in links can cause problems for servers (basically they don't recognise them) 
     249  //  so you can use this flag to ensure that all characters other than the normal ascii set (actually 
     250  //  only ! through ~) are escaped in URLs to % codes 
     251  this.only7BitPrintablesInURLs = true; 
    247252 
    248253  // sometimes we want to be able to replace some string in the html comng in and going out 
     
    19481953    { 
    19491954      var html = this.outwardHtml(this.getHTML()); 
    1950       this._textArea.value = html; 
     1955      this.setHTML(html); 
    19511956 
    19521957      // Hide the iframe 
     
    19691974      var html = this.inwardHtml(this.getHTML()); 
    19701975      this.deactivateEditor(); 
    1971       if (!this.config.fullPage) 
    1972       { 
    1973         this._doc.body.innerHTML = html; 
    1974       } 
    1975       else 
    1976       { 
    1977         this.setFullHTML(html); 
    1978       } 
     1976      this.setHTML(html); 
    19791977      this._iframe.style.display   = ''; 
    19801978      this._textArea.style.display = "none"; 
     
    42384236// completely change the HTML inside 
    42394237HTMLArea.prototype.setHTML = function(html) { 
    4240   switch (this._editMode) 
    4241   { 
    4242     case "wysiwyg"  : 
    4243     { 
    4244       if (!this.config.fullPage) 
    4245       { 
    4246         this._doc.body.innerHTML = html; 
    4247       } 
    4248       else 
    4249       { 
    4250         this.setFullHTML(html); 
    4251       } 
    4252     } 
    4253     break; 
    4254  
    4255     case "textmode" : 
    4256     { 
    4257       this._textArea.value = html; 
    4258     } 
    4259     break; 
    4260  
    4261     default             : 
    4262     { 
    4263       alert("Mode <" + mode + "> not defined!"); 
    4264     } 
    4265     break; 
    4266   } 
    4267   return false; 
     4238  if (!this.config.fullPage) 
     4239  { 
     4240    this._doc.body.innerHTML = html; 
     4241  } 
     4242  else 
     4243  { 
     4244    this.setFullHTML(html); 
     4245  } 
     4246  this._textArea.value = html; 
    42684247}; 
    42694248 
     
    47124691              value = editor.stripBaseURL(value); 
    47134692            } 
     4693 
     4694            // High-ascii (8bit) characters in links seem to cause problems for some sites, 
     4695            // while this seems to be consistent with RFC 3986 Section 2.4 
     4696            // because these are not "reserved" characters, it does seem to 
     4697            // cause links to international resources not to work.  See ticket:167 
     4698 
     4699            // IE always returns high-ascii characters un-encoded in links even if they 
     4700            // were supplied as % codes (it unescapes them when we pul the value from the link). 
     4701 
     4702            // Hmmm, very strange if we use encodeURI here, or encodeURIComponent in place 
     4703            // of escape below, then the encoding is wrong.  I mean, completely. 
     4704            // Nothing like it should be at all.  Using escape seems to work though. 
     4705            // It's in both browsers too, so either I'm doing something wrong, or 
     4706            // something else is going on? 
     4707 
     4708            if(editor.config.only7BitPrintablesInURLs) 
     4709            { 
     4710              value = value.replace(/([^!-~]+)/g, function(match) { return escape(match); }); 
     4711            } 
    47144712          } 
    47154713        } else { // IE fails to put style in attributes list 
     
    47554753  return html; 
    47564754}; 
     4755 
     4756/** @see getHTMLWrapper (search for "value = a.nodeValue;") */ 
    47574757 
    47584758HTMLArea.prototype.stripBaseURL = function(string) 
Note: See TracChangeset for help on using the changeset viewer.