Comments (11)
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.
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.
Cool, thanks for the update! ❤️
from elixir-json.
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.
Heya! Sure, I'll try to investigate this ASAP. Probably won't be able to do much until late Saturday tho
from elixir-json.
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.
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.
Thanks for the debugging @belucid, this will help a lot :)
from elixir-json.
WIP for fix: #30
from elixir-json.
@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.
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)
- Passing char lists to Regex is deprecated HOT 5
- Travis build is breaking HOT 2
- Escaping issues with forward slash HOT 6
- Update Elixir dependency for Elixir 1.0.0 HOT 3
- newlines in strings are converted to "\n" literal in output by default. HOT 3
- Struct Support, HOT 11
- [META] Moving this project to an organization to give community control over it HOT 19
- Comparison with Poison HOT 2
- JSON and Docker HOT 3
- Please produce a new release HOT 1
- META - Sorry for the long absence HOT 2
- decoded data is getting sorted. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elixir-json.