Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7988

Show
Ignore:
Timestamp:
10/22/07 11:20:21 (1 year ago)
Author:
tobie
Message:

prototype: Make the Ajax.Response#headerJSON property correctly decode unicode characters. Closes #9285

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinoffs/prototype/trunk/CHANGELOG

    r7986 r7988  
    11*SVN* 
     2 
     3* Make the Ajax.Response#headerJSON property correctly decode unicode characters. Closes #9285. [Marius Feraru, Tobie Langel] 
    24 
    35* Make sure Event and Event.extend are defined before wrapping events and calling their handler. Prevents a known Firefox bug from throwing errors on page load/unload (cf.: https://bugzilla.mozilla.org/show_bug.cgi?id=361271). Closes #5393, #9421. [staaky, John Resig, sam, Tobie Langel] 
  • spinoffs/prototype/trunk/src/ajax.js

    r7855 r7988  
    277277  _getHeaderJSON: function() { 
    278278    var json = this.getHeader('X-JSON'); 
    279     try { 
    280       return json ? json.evalJSON(this.request.options.sanitizeJSON) : null; 
     279    if (!json) return null; 
     280    json = decodeURIComponent(escape(json)); 
     281    try { 
     282      return json.evalJSON(this.request.options.sanitizeJSON); 
    281283    } catch (e) { 
    282284      this.request.dispatchException(e); 
  • spinoffs/prototype/trunk/test/unit/ajax.html

    r7265 r7988  
    6161     
    6262    headerJson: { 
    63       'X-JSON': '{"test": 123}' 
     63      'X-JSON': '{"test": "hello #éà"}' 
    6464    } 
    6565  }; 
     
    348348          parameters: Fixtures.headerJson, 
    349349          onComplete: function(transport, json) { 
    350             assertEqual(123, transport.headerJSON.test); 
    351             assertEqual(123, json.test); 
     350            assertEqual('hello #éà', transport.headerJSON.test); 
     351            assertEqual('hello #éà', json.test); 
    352352          } 
    353353        }));