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

Encoding question..

Expand Messages
  • mpcmtechnologies
    I have a string containing a single character. I m not quite sure what this string should look like once json encoded. My javascript encoder (a popular one)
    Message 1 of 3 , Jul 19 5:38 PM
    • 0 Attachment
      I have a string containing a single \ character. I'm not quite sure
      what this string should look like once json encoded. My javascript
      encoder (a popular one) is giving me `\\\\` ? Shouldn't the correct
      encoding be `\\`?

      --
      Matt
    • Douglas Crockford
      ... No, it should be . JSON does not use the ` character.
      Message 2 of 3 , Jul 19 8:07 PM
      • 0 Attachment
        --- In json@yahoogroups.com, "mpcmtechnologies" <WickedLogic@g...> wrote:
        > I have a string containing a single \ character. I'm not quite sure
        > what this string should look like once json encoded. My javascript
        > encoder (a popular one) is giving me `\\\\` ? Shouldn't the correct
        > encoding be `\\`?

        No, it should be "\\". JSON does not use the ` character.
      • MPCM
        ... Sorry, I have a value of and it is encoding it to . The backticks where added to show that that was the value. Sorry for the confusion. The parser I
        Message 3 of 3 , Jul 19 8:28 PM
        • 0 Attachment
          On 7/19/05, Douglas Crockford <douglas@...> wrote:
          > No, it should be "\\". JSON does not use the ` character.

          Sorry, I have a value of \ and it is encoding it to \\\\. The
          backticks where added to show that that was the value. Sorry for the
          confusion.

          The parser I am using is the javascript one provided via your site,
          [http://www.crockford.com/JSON/json.js%5d.

          Strange, I just tried to generate a test and could not get it to
          repeat what I felt was wrong encoding... must have been something in
          my code. I'll post a follow up if I am able to reproduce it tomorrow
          at work.

          Thank you for setting up these groups and hosting the json site. It
          really is much more fun than xml-rpc.

          --
          Matthew P. C. Morley
        Your message has been successfully submitted and would be delivered to recipients shortly.