Loading ...
Sorry, an error occurred while loading the content.

Re: Problems with content type text/json

Expand Messages
  • smit_al
    We are using JSON in some of our applications that communicate with ExtJS. Try changing your content type to the following. Content-Type: text/plain ... on
    Message 1 of 3 , Sep 1, 2008
    • 0 Attachment
      We are using JSON in some of our applications that communicate with
      ExtJS. Try changing your content type to the following.

      Content-Type: text/plain



      --- In Easy400Group@yahoogroups.com, "Wolfgang Kubens"
      <wolfgang.kubens@...> wrote:
      >
      > I am one of the developer of this web application
      > http://ajaxian.com/archives/new-ajax-for-old-iron
      > <http://ajaxian.com/archives/new-ajax-for-old-iron%20>
      >
      > Some words concerning the application itself. This application is
      > splitted into two parts. First part is the frontend which is based
      on
      > Extjs library and second part is the backend which contains the
      business
      > logic wich runs on an i5, apache and rpg environment. The complete
      > communication between frontend and backend is Ajax based. As you
      can see
      > it is just a simple web application.
      >
      > Due of an update to the newest Firefox (FF3.0) we pointed out that
      our
      > little application does never work properly. Reason therefore is
      that
      > the Ajax based communication uses Json as prefered format, but this
      > requires that the response header must use as content-type
      text/json.
      > All important browsers IE6/IE7, Opera and FF2 were able to handle
      > response with text/html as content type. As far as good, but FF3 is
      more
      > puristic or fussy means this browser expects correct content-type.
      As
      > far as good, because the reason and the solutions therefore sounds
      > simple. Normally you would ensure that the expected content-type is
      set
      > to text/json and finish. But on the i5 this does not solve our
      problem,
      > because instead to get a valid response the response is crypted.
      Result
      > of our activities is that the complete communication breaks down.
      >
      > RPG output text/html:
      > Response Header: Content-type:text/html; charset=ISO-8859-1
      > Response Body: ({"totalCount":"1", "WPSHP":[{"name":
      > "field1","value":"äöü"}]})
      >
      > RPG output text/json:
      > Response Header: Content-type:text/json; charset=ISO-8859-1
      > Response Body: �% ���������� z@�%
      >
      > On a separate Unix and PHP based playground this works as expected:
      >
      > PHP output text/html:
      > Response Header: Content-type:text/html; charset=ISO-8859-1
      > Response Body: ({"totalCount":"1", "WPSHP":[{"name":
      > "field1","value":"äöü"}]})
      >
      > PHP output text/json:
      > Response Header: Content-type:text/json; charset=ISO-8859-1
      > Response Body: ({"totalCount":"1", "WPSHP":[{"name":
      > "field1","value":"äöü"}]})
      >
      > So we assume that on the i5 the usage of content-type text/json
      causes a
      > converting of output stream into this cryptical output (binary???).
      Our
      > questions are:
      >
      > Does anybody else have made any experiences with content-type
      text/json?
      > Does anybody else knows how we can prevent this cryptical
      converting?
      >
      > It would be great if anybody has a hint, a self explaining example
      or at
      > least a link where we can read what we must do or change?
      >
      > Thanks in advance
      > Wolfgang
      >
    • hr@common.dk
      Hi, I had to make a AddType text/xml to the apache server conf in order to get this header to work as response to an ajax call... Content-type: text/xml
      Message 2 of 3 , Sep 1, 2008
      • 0 Attachment

        Hi,

        I had to make a "AddType text/xml" to the apache server conf in order to get this header
        to work as response to an ajax call...

        Content-type: text/xml                            
                                                         
        <?xml version="1.0" encoding="ISO-8859-1"?>

        you may try add an "AddType text/json" to the apache config.

        however if you look at saki's ext example page ( http://examples.extjs.eu/ ) under PHP many
        responses uses (and runs at FF 3.0)

        Content-type: application/json


        So maybe the Addtype should be this.

        Just a guess

        rgds
        Henrik

               



        "Wolfgang Kubens" <wolfgang.kubens@...>
        Sent by: Easy400Group@yahoogroups.com

        31-08-2008 18:31

        Please respond to
        Easy400Group@yahoogroups.com

        To
        Easy400Group@yahoogroups.com
        cc
        Subject
        [Easy400Group] Problems with content type text/json





        I am one of the developer of this web application http://ajaxian.com/archives/new-ajax-for-old-iron  

        Some words concerning the application itself. This application is splitted into two parts. First part is the frontend which is based on Extjs library and second part is the backend which contains the business logic wich runs on an i5, apache and rpg environment. The complete communication between frontend and backend is Ajax based. As you can see it is just a simple web application.

        Due of an update to the newest Firefox (FF3.0) we pointed out that our little application does never work properly. Reason therefore is that the Ajax based communication uses Json as prefered format, but this requires that the response header must use as content-type text/json. All important browsers IE6/IE7, Opera and FF2 were able to handle response with text/html as content type. As far as good, but FF3 is more puristic or fussy means this browser expects correct content-type. As far as good, because the reason and the solutions therefore sounds simple. Normally you would ensure that the expected content-type is set to text/json and finish. But on the i5 this does not solve our problem, because instead to get a valid response the response is crypted. Result of our activities is that the complete communication breaks down.

        RPG output text/html:
        Response Header: Content-type:text/html; charset=ISO-8859-1
        Response Body: ({"totalCount":"1", "WPSHP":[{"name": "field1","value":"äöü"}]})

        RPG output text/json:

        Response Header: Content-type:text/json; charset=ISO-8859-1
        Response Body: �%  ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ z@�%


        On a separate Unix and PHP based playground this works as expected:

        PHP output text/html:
        Response Header: Content-type:text/html; charset=ISO-8859-1
        Response Body: ({"totalCount":"1", "WPSHP":[{"name": "field1","value":"äöü"}]})

        PHP output text/json:

        Response Header: Content-type:text/json; charset=ISO-8859-1
        Response Body: ({"totalCount":"1", "WPSHP":[{"name": "field1","value":"äöü"}]})

           
        So we assume that on the i5 the usage of content-type text/json causes a converting of output stream into this cryptical output (binary???). Our questions are:

        Does anybody else have made any experiences with content-type text/json?
        Does anybody else knows how we can prevent this cryptical converting?

        It would be great if anybody has a hint, a self explaining example or at least a link where we can read what we must do or change?

        Thanks in advance
        Wolfgang


      Your message has been successfully submitted and would be delivered to recipients shortly.