Code Monkey home page Code Monkey logo

Comments (11)

cblage avatar cblage commented on August 31, 2024

Thanks for the bug report. I'll look into this ASAP.

Sent from mobile

On Sep 30, 2014, at 7:07 PM, Nathan Zorn [email protected] wrote:

The parser seems to have issues with some unicode strings.

iex(8)> JSON.decode("{"name": "Fahad Al-Esmail \u00f8"}")
{:ok, %{"name" => "Fahad Al-Esmail ø"}}
iex(9)> JSON.decode("{"name": "Fahad Al-Esmail \ud83c"}")
** (ArgumentError) argument error
lib/json/parser/bitstring/string.ex:85: JSON.Parser.Bitstring.String.parse_escaped_unicode_codepoint/3
lib/json/parser/bitstring/string.ex:65: JSON.Parser.Bitstring.String.parse_string_contents/2
lib/json/parser/bitstring/object.ex:50: JSON.Parser.Bitstring.Object.parse_object_value/3
lib/json/decoder.ex:30: JSON.Decoder.BitString.decode/1


Reply to this email directly or view it on GitHub.

from elixir-json.

thepug avatar thepug commented on August 31, 2024

So, turns out my issue was an elixir/erlang upgrade. I didn't rebuild and got this error. After rebuilding everything it works now.

from elixir-json.

cblage avatar cblage commented on August 31, 2024

Cool, thanks for the update! ❤️

from elixir-json.

belucid avatar belucid commented on August 31, 2024

Actually... it turns out it had nothing to do with the elixir/erlang upgrade. (I work with @thepug ). If you could re-open this issue and look into it @cblage , we'd be much obliged!

from elixir-json.

cblage avatar cblage commented on August 31, 2024

Heya! Sure, I'll try to investigate this ASAP. Probably won't be able to do much until late Saturday tho

from elixir-json.

belucid avatar belucid commented on August 31, 2024

Here's a definitive failure from the console where Jiffy handles it fine:

iex(30)> s = "{\"foo\":\"I love emoji! \\ud83c\\uddfa\\ud83c\\uddf8 So do you!\"}"                                                                                                 "{\"foo\":\"I love emoji! \\ud83c\\uddfa\\ud83c\\uddf8 So do you!\"}"
iex(31)> :jiffy.decode(s)
{[{"foo", "I love emoji! 🇺🇸 So do you!"}]}
iex(32)> JSON.decode(s)                                                                                                                                                            ** (ArgumentError) argument error
    lib/json/parser/bitstring/string.ex:85: JSON.Parser.Bitstring.String.parse_escaped_unicode_codepoint/3
    lib/json/parser/bitstring/string.ex:65: JSON.Parser.Bitstring.String.parse_string_contents/2
    lib/json/parser/bitstring/object.ex:50: JSON.Parser.Bitstring.Object.parse_object_value/3
    lib/json/decoder.ex:30: JSON.Decoder.BitString.decode/1

from elixir-json.

belucid avatar belucid commented on August 31, 2024

In particular, it is 4-byte Emoji Unicode that seems to be the problem. Those 4-bytes of Unicode are a US flag emoji for example:

http://www.iemoji.com/view/emoji/176/places/regional-indicator-symbol-letters-us

from elixir-json.

cblage avatar cblage commented on August 31, 2024

Thanks for the debugging @belucid, this will help a lot :)

from elixir-json.

cblage avatar cblage commented on August 31, 2024

WIP for fix: #30

from elixir-json.

cblage avatar cblage commented on August 31, 2024

@belucid I've been completely swamped recently, if anyone wants to contribute with a fix, please feel free. I'm doing my best to get this fixed soonish 😶

from elixir-json.

hectorip avatar hectorip commented on August 31, 2024

So far as I've seen nobody has worked on this, am I right. I need this fixed for my project; I think I will be working on this today.

from elixir-json.

Related Issues (13)

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.