JSONVariable._dumps is returning a byte string when it ought to return a unicode string

Bug #846867 reported by Gavin Panella
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Storm
Fix Released
Medium
Gavin Panella

Bug Description

lifeless said in bug 845904:

> That would be wrong - JSON is a text format (see
> http://www.ietf.org/rfc/rfc4627.txt section 3).
>
> "3. Encoding
>
> JSON text SHALL be encoded in Unicode. The default encoding is
> UTF-8."
>
> So BYTEA is just bonkers. We shouldn't use that and should help
> storm get fixed.

In other words, JSONVariable._dumps() should return a unicode string,
and the JSON property which uses it should ordinarily be used with a
column type that holds unicode text, e.g. TEXT in PostgreSQL.

Related branches

Revision history for this message
Gavin Panella (allenap) wrote :

There's more discussion in bug 845904. I think the choice boils down
to whether you want to store stuff in your database as bytes or as a
"proper" data type. For PostgreSQL this means TEXT or BYTEA. The JSON
RFC unequivocally says that JSON is text-based, so it makes sense to
me to use the database's richer type support.

tl;dr This bug is confirmed.

Changed in storm:
status: New → Confirmed
Revision history for this message
Stuart Bishop (stub) wrote :

Not a backwards compatibility issue, as json support hasn't been in an actual release yet. It landed with https://code.launchpad.net/~jkakar/storm/json-property/+merge/51634

Changed in storm:
milestone: none → 0.19
Jamu Kakar (jkakar)
Changed in storm:
assignee: nobody → Gavin Panella (allenap)
importance: Undecided → Medium
status: Confirmed → In Progress
Gavin Panella (allenap)
Changed in storm:
status: In Progress → Fix Committed
Barry Warsaw (barry)
Changed in storm:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.