Status: New
Owner: ----
Labels: Version Type-Bug Priority-Medium OpSys-Any Dist-Any Arch-Any  
Desktop-Any GUI-Any

New issue 474 by uale...@gmail.com: JSON Encode created wrong unicode for  
none-printable ascii characters
http://code.google.com/p/gambas/issues/detail?id=474

1) Describe the problem.

When using none-printable ascii characters in a string or collection and  
convert them JSON.Encode, the conversion to unicode goes wrong (looks like  
invalid data).

See the following JSON.Encode output:
{"Hex-00": "\u00x0", "Hex-01": "\u00x0", "Hex-14": "\u00x1", "Hex-15": "\u00x1"}

It converts hex-00 to "\u00x0", this should have been "\u0000".
It converts hex-01 to "\u00x0", this should have been "\u0001".
It converts hex-14 to "\u00x1", this should have been "\u000E".
It converts hex-15 to "\u00x1", this should have been "\u000F".

The JSON.Decode works correctly with "\u0001", "\u000E", etc.

Only the "\u0000" gets lost during conversion with JSON.Decode, but i am  
not sure if that is as designed.

2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):

Version: 3.4.2 & 3.5.0 tested (same result)
Revision: r1234 (if you use a development version)
Operating system: Linu
Distribution: Ubuntu 13.04
Architecture: x86_64
GUI component: QT3 / QT4 / GTK+
Desktop used: Gnome / KDE ...

3) Provide a little project that reproduces the bug or the crash.

See attached project.

4) If your project needs a database, try to provide it, or part of it.

5) Explain clearly how to reproduce the bug or the crash.

6) By doing that carefully, you have done 50% of the bug fix job!

IMPORTANT NOTE: if you encounter several different problems or bugs, (for
example, a bug in your project, and an interpreter crash while debugging
it), please create distinct issues!

Attachments:
        Test.json.unicode.tar  20.0 KB

-- 
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to