missing charset or bung server settings?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bobs

    missing charset or bung server settings?

    Hello, I was wondering if some one could take a look at the two
    example server outputs below, and help me understand what is wrong.
    I'm getting garbled characters.

    The php script I'm developing delivers XML to a client side
    application I'm also putting together in VB.NET .. Example 1 is my
    development PC.. It has a recent build of PDP & Apache. This output is
    good.

    Example 2 is the production server and is adding all sorts of strange
    characters, that are causing the XML to be invalid.

    I'm thinking it has somthing to do with the lack of charset in Ex2..
    perhaps. If that is the case can I specify it in the .htaccess file
    because I dont have direct control over the production server. Has any
    one seen this before?

    Thanks
    DaveC

    ******** EXAMPLE 1 *************

    HTTP/1.1 200 OK
    Date: Mon, 22 Nov 2004 10:34:20 GMT
    Server: Apache/2.0.52 (Win32)
    X-Powered-By: PHP/5.0.2
    Connection: close
    Transfer-Encoding: chunked
    Content-Type: text/html; charset=ISO-8859-1

    fcc
    o;?<app><name>e ek</name><author>Me </author><version >0.1</version><contac t>me@.com</contact></app><link
    ....


    ******** EXAMPLE 2 *************

    HTTP/1.1 200 OK
    Date: Sun, 21 Nov 2004 13:48:28 GMT
    Server: Apache
    X-Powered-By: PHP/4.3.4
    Connection: close
    Transfer-Encoding: chunked
    Content-Type: text/html

    8d
    o;?<app><name>e ek</name><author>Me </author><version >0.1</version><contac t>Me@.com</contact></app>
    2e
    <link src="example" rank="1" type="se">
    1f
    <url>http://www.petz.com/</url>
    1b
    <title>Petz Central</title>
    c5
  • Pedro Graca

    #2
    Re: missing charset or bung server settings?

    bobs wrote:
    <snip>[color=blue]
    > I'm thinking it has somthing to do with the lack of charset in Ex2..
    > perhaps. If that is the case can I specify it in the .htaccess file
    > because I dont have direct control over the production server. Has any
    > one seen this before?[/color]
    <snip>

    Don't know if it helps, but you can try header() in the PHP script.



    header('Content-Type: text/xml; charset=ISO-8859-1');
    /* Why text/html? ^^^^^^^^ */

    --
    Mail sent to my "From:" address is publicly readable at http://www.dodgeit.com/
    == ** ## !! !! ## ** ==
    TEXT-ONLY mail to the complete "Reply-To:" address ("My Name" <my@address>) may
    bypass the spam filter. I will answer all pertinent mails from a valid address.

    Comment

    • Andy Hassall

      #3
      Re: missing charset or bung server settings?

      On 21 Nov 2004 06:10:39 -0800, bobason456@hotm ail.com (bobs) wrote:
      [color=blue]
      >Hello, I was wondering if some one could take a look at the two
      >example server outputs below, and help me understand what is wrong.
      >I'm getting garbled characters.
      >
      >The php script I'm developing delivers XML to a client side
      >application I'm also putting together in VB.NET .. Example 1 is my
      >development PC.. It has a recent build of PDP & Apache. This output is
      >good.
      >
      >Example 2 is the production server and is adding all sorts of strange
      >characters, that are causing the XML to be invalid.
      >
      >I'm thinking it has somthing to do with the lack of charset in Ex2..
      >perhaps. If that is the case can I specify it in the .htaccess file
      >because I dont have direct control over the production server. Has any
      >one seen this before?[/color]

      Both outputs look similar to me. They're chunked transfer-encoded. If you're
      using the output directly, your client is broken, as it's not decoding the
      chunks, which IIRC is a required capability of any HTTP/1.1 client.


      [color=blue]
      >******** EXAMPLE 1 *************
      >
      >HTTP/1.1 200 OK
      >Date: Mon, 22 Nov 2004 10:34:20 GMT
      >Server: Apache/2.0.52 (Win32)
      >X-Powered-By: PHP/5.0.2
      >Connection: close
      >Transfer-Encoding: chunked
      >Content-Type: text/html; charset=ISO-8859-1
      >
      >fcc[/color]

      Chunk size here. Indicates it's 4,044 bytes long. Presumably this covers the
      entire document in one chunk.
      [color=blue]
      >o;?<app><name> eek</name><author>Me </author><version >0.1</version><contac t>me@.com</contact></app><link
      >...
      >
      >
      >******** EXAMPLE 2 *************
      >
      >HTTP/1.1 200 OK
      >Date: Sun, 21 Nov 2004 13:48:28 GMT
      >Server: Apache
      >X-Powered-By: PHP/4.3.4
      >Connection: close
      >Transfer-Encoding: chunked
      >Content-Type: text/html
      >
      >8d[/color]

      Chunk #1, 0x8d = 141 bytes.
      [color=blue]
      >o;?<app><name> eek</name><author>Me </author><version >0.1</version><contac t>Me@.com</contact></app>[/color]

      Data for chunk #1.
      [color=blue]
      >2e[/color]
      Chunk #2, 0x2e = 30 bytes.
      [color=blue]
      ><link src="example" rank="1" type="se">[/color]

      Data for chunk #2.
      [color=blue]
      >1f
      ><url>http://www.petz.com/</url>
      >1b
      ><title>Petz Central</title>
      >c5[/color]

      And so on...

      If your client can't handle this, perhaps it should be making HTTP/1.0
      requests.

      --
      Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
      <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

      Comment

      Working...