JSONVariable._dumps is returning a byte string when it ought to return a unicode string
Bug #846867 reported by
Gavin Panella
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://
>
> "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.
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
lp://staging/~allenap/storm/json-variable-unicode-bug-846867
- Stuart Bishop (community): Approve
- Jamu Kakar (community): Approve
-
Diff: 87 lines (+30/-5)3 files modifiedstorm/variables.py (+13/-1)
tests/variables.py (+16/-3)
tests/zope/zstorm.py (+1/-1)
Changed in storm: | |
assignee: | nobody → Gavin Panella (allenap) |
importance: | Undecided → Medium |
status: | Confirmed → In Progress |
Changed in storm: | |
status: | In Progress → Fix Committed |
Changed in storm: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
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.