Podger2016 / rapidjson

Automatically exported from code.google.com/p/rapidjson
0 stars 0 forks source link

Fails to parse UTF8 strings with BOM. #26

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create UTF8 file using ordinary text editor (Nodepad++). By default it is 
created with BOM.
2. load file as raw binary file
3. pass to rapidjson Document to parse

Parsing fails with error "Expect either an object on array at root".

Original issue reported on code.google.com by Slav...@gmail.com on 8 Jun 2012 at 8:16

GoogleCodeExporter commented 8 years ago
BOM is not supported in 0.1x. It is not a "bug" but a missing feature.
Encoding conversions with BOM detection was implemented in the newer version in 
the trunk.

Original comment by milo...@gmail.com on 8 Jun 2012 at 8:21

GoogleCodeExporter commented 8 years ago
I cloned repository from github just yesterday. Is it need to checkout from 
google-code?

Original comment by Slav...@gmail.com on 8 Jun 2012 at 8:49

GoogleCodeExporter commented 8 years ago
Rapidjson does not have an official repository on github. I think it may be the 
first released version 0.1, copied to github by someone.

Original comment by milo...@gmail.com on 8 Jun 2012 at 9:31

GoogleCodeExporter commented 8 years ago
Ok, got it - not to use github's version.

Original comment by Slav...@gmail.com on 8 Jun 2012 at 11:11

GoogleCodeExporter commented 8 years ago
Trunk SVN (from code.google.com) version does not support it either.

Original comment by Slav...@gmail.com on 14 Jun 2012 at 4:06

GoogleCodeExporter commented 8 years ago
Please refer to 
http://code.google.com/p/rapidjson/source/browse/trunk/test/unittest/encodedstre
amtest.cpp

Original comment by milo...@gmail.com on 15 Jun 2012 at 2:07

GoogleCodeExporter commented 8 years ago
Sorry, but I cannot understand what I must see there. What is "utf8.json"?
Anyway, I skipped first 3 bytes of UTF8+BOM text file within my project and 
Rapidjson parsed it well.
Did you meant by that link that UTF8 with BOM is not supported and will not be 
ever or that it is already supported?
Thank you.

Original comment by Slav...@gmail.com on 15 Jun 2012 at 1:58

GoogleCodeExporter commented 8 years ago
Hum. The examples and documentation is not ready yet.

I think this example may help you with the new encoding feature, which also 
handles BOM.

http://code.google.com/p/rapidjson/source/browse/trunk/example/prettyauto/pretty
auto.cpp

Original comment by milo...@gmail.com on 16 Jun 2012 at 1:36