X-JSON encoding problem

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

    X-JSON encoding problem

    Hi,
    I have problem with X-JSON. I am sending, in header, Polish chars,
    that are correct encoded in database, but when they came through
    header something wrong happen with encoding and I can only see
    strange
    signs at page. I am using UTF-8.

    Please help, because all my ajax requests are based on sending data
    in
    header.

    Sincerely,
    Gene
  • Gufo Rosso

    #2
    Re: X-JSON encoding problem

    Gene ha scritto:
    Hi,
    I have problem with X-JSON. I am sending, in header, Polish chars,
    that are correct encoded in database, but when they came through
    header something wrong happen with encoding and I can only see
    strange
    signs at page. I am using UTF-8.
    >
    Please help, because all my ajax requests are based on sending data
    in
    header.
    >
    {data: base64_encode(s tringdata)}


    Sincerely,
    Gene

    Comment

    • Bart Van der Donck

      #3
      Re: X-JSON encoding problem

      Gufo Rosso wrote:
      Gene ha scritto:
      >
      >I have problem with X-JSON. I am sending, in header, Polish chars,
      HTTP headers can only contain ASCII characters.
      >that are correct encoded in database,
      There are many choices to store Polish characters: ISO 8859-2,
      Windows-1250, ISO-IR 101, UTF-7, UTF-8, UTF-16, ... None of those is
      more "correct" than the other.
      >but when they came through header something wrong happen with
      >encoding and I can only see strange signs at page. I am using UTF-8.
      What are these strange signs ? When you want UTF-8, I suspect that,
      for example, a Polish character like:

      \u017a (LATIN SMALL LETTER Z WITH ACUTE)

      from database could be displayed on your screen like:

      \u00c5\u00ba (LATIN CAPITAL LETTER A WITH RING ABOVE, followed
      by MASCULINE ORDINAL INDICATOR)

      This means that the two-byte sequence is not recognized as UTF-8.

      There are three actors involved:
      - Which encoding is used by the database
      - How it read by the app and transferred (Content-Type header)
      - How the webpage displays the data
      >Please help, because all my ajax requests are based on sending data
      >in header.
      >
      {data: base64_encode(s tringdata)}
      Base64-encodings should only be used to transfer binary data over 7-
      bit paths. It makes no sense to use it for UTF-8. You are
      theoretically correct that the data will be ASCII-safe (as required
      for HTTP headers), but far too big to be stored there. The body-part
      of the message is intended for this task.

      Hope to have helped more than confused,

      --
      Bart

      Comment

      Working...