Coder Social home page Coder Social logo

Comments (6)

Kalzem avatar Kalzem commented on June 17, 2024

Ah I found something interesting.

It seems like the error is random.

From my gist example, I have tested by only taking the first item and removing the rest.

So I only have this left:

{
  "version": 1,
  "items": [
    {
      "id": "en_cat",
      "name": "cat",
      "lang": "en",
      "defs": [
        {
          "id": "en_cat_1",
          "def": "A cat is a domestic animal of the feline family.",
          "trans": {
            "fr": ["fr_chat_1"],
            "ru": ["ru_ко́шка_1"]
          },
          "ex": [
            "My cat is lazy and never hunts mice.",
            "Tigers are just very big cats."
          ]
        }
      ]
    }
  ]
}

It still doesn't work.

But if I change this:

    "trans": {
        "fr": ["fr_chat_1"],
        "ru": ["ru_ко́шка_1"]
      },

into

    "trans": {
        "fr": "fr_chat_1",
        "ru": "ru_ко́шка_1"
      },

it seems to be working...

Now I put back all the items from my initial gist and convert the array of Russian strings into just a Russian string (no array). It doesn't work anymore...

I do believe there is something wrong in how non-ascii characters are handled in the values (and not keys contrary to the error displayed).

from zippyjson.

Kalzem avatar Kalzem commented on June 17, 2024

Okay, last additional info:

I think there is something strange going on in this function: static inline bool JNTCheck(ParsedJson::iterator i)

The comment says Check if there are any non-ASCII chars in the dictionary keys, but I found out that it checks also values, not only keys.

Especially this part:

image

For any ASCII value, it returns false, but for Russian values it returns true

(lldb) p i.get_string() // English value - returns false
(const char *) $1 = 0x00007fec448172b8 "fr_chat_1"
(lldb) p i.get_string() // Russian value - returns true
(const char *) $2 = 0x00007fec448172cd "ru_\xffffffd0\xffffffba\xffffffd0\xffffffbe\xffffffcc\xffffff81\xffffffd1\xffffff88\xffffffd0\xffffffba\xffffffd0\xffffffb0_1"

What is the purpose of this check? If I deactivate it, everything is correctly parsed.

from zippyjson.

michaeleisel avatar michaeleisel commented on June 17, 2024

Which version of the library are you using, and how did you install it?

from zippyjson.

Kalzem avatar Kalzem commented on June 17, 2024

I am using 0.0.5 with Cocoapods.

from zippyjson.

michaeleisel avatar michaeleisel commented on June 17, 2024

yes, this is a legitimate bug. thank you for all the info! i've put a fix in, michaeleisel/ZippyJSONCFamily@100e71b

from zippyjson.

michaeleisel avatar michaeleisel commented on June 17, 2024

actually michaeleisel/ZippyJSONCFamily@2b60469

from zippyjson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.