0

In Firebug net tab, in Response\Json tabs, I can see the value returned from CGI, using ajax:

enter image description here

I want to verify the exact characters values, so I can translate it into readable characters (and in the next step, store my values in the same encoding.)

How can I get this value in Javascript?

I tried to use encodeURI() on the ajax returned response, but I only got some [%EF%BF%BD] (the black-diamond-question-mark)

my JS code:
  var jqxhr = $.ajax({
        type: "GET",
        url: AJAX_CGI_URL,
        dataType : 'json',
        cache: false,
        data: { name: AJAX_PARAMS }
        })

    . . .

    case "P_D":
      for(var j = 0; j < varVal.length; j++) {
        jj=j+1;
        updateWidget("d" + jj, varVal[j]);
        var res = encodeURI(varVal[j]);
        console.log(jj + ": " + res);
    } break;


  =>
  console log:
  GET http://.../cgi-bin/xjgetvar.cgi ...
  1: %EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%20%EF%BF%BD%EF%BF%BD%EF%BF%BD
   which is actually => %EF%BF%BD %EF%BF%BD %EF%BF%BD %EF%BF%BD %20 %EF%BF%BD %EF%BF%BD %EF%BF%BD

[relates to my previous question - JavaScript encodes Hebrew string I thought it will be easy to get the values Firebug shows. but it is not trivial :( ]

so my question now is - How can I get the same values Firebug gets ?!

Community
  • 1
  • 1
Atara
  • 3,523
  • 6
  • 37
  • 56
  • well you need to decode it, not encode it, but anyways, this is no url-encoded string. Can you show the response-headers, maybe the request-headers too. – Thomas Jun 08 '16 at 13:04
  • response headers: HTTP/1.1 200 OK Content-Type: text/javascript Transfer-Encoding: chunked Date: Thu, 09 Jun 2016 08:05:41 GMT Server: lighttpd/1.4.28 – Atara Jun 09 '16 at 08:50
  • request headers: GET /cgi-bin/xjgetvar.cgi?name=P_D%7CP_P%7CP_TYP%7CP_T%7CP_U%7CP_LBE%7CP_UBE&_=1465459629395 HTTP/1.1 Host: myIp... User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:46.0) Gecko/20100101 Firefox/46.0 Accept: application/json, text/javascript, */*; q=0.01 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate X-Requested-With: XMLHttpRequest Referer: http://myIP/prb_config/prb_config.html Cookie: magcheck_user=admin; magcheck_pass=c98...4f1 Connection: keep-alive – Atara Jun 09 '16 at 08:51

0 Answers0