Issue1553

classification
Title: Encoding problems in dbexts.py - unicode, html
Type: behaviour Severity: normal
Components: Library, zxjdbc Versions: Jython 2.5
Milestone:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, w_hunger, zyasoft
Priority: low Keywords:

Created on 2010-02-09.15:08:08 by w_hunger, last changed 2014-10-07.00:19:19 by zyasoft.

Messages
msg5510 (view) Author: Werner Hunger (w_hunger) Date: 2010-02-09.15:08:05
Database access behaves differently in Jython 2.1 and 2.5.1: Cursors return binary string in 2.1 and unicode strings in 2.5.1. I'm not sure which is the correct behaviour according to the API, but in 2.5.1, the usage of dbexts.console() will fail in line 85 as soon as one data item is not encodeable in ASCII:

85:             row = map(lambda x: str(x), row)

A naïve Fix would be

85:             row = map(lambda x: unicode(x), row)
msg5958 (view) Author: Jim Baker (zyasoft) Date: 2010-08-14.20:07:48
First, dbexts is definitely a module we would not include in Jython today, since it would be better to just have it be in PyPI. Secondly, it has no unit tests! That's the bigger problem here, now that Jython dev has standardized on unit testing in nearly every code change.

There are a number of encoding issues here. Besides console, another example is seen in dbexts.html function, which does not even encode the output for HTML, so it looks like it's a good candidate for a SQL injection attack.

Perhaps the functionality of dbexts (its zxJDBC support) should be merged with 
SQLPython? This is a maintained shell with an active user group. See http://packages.python.org/sqlpython/

No good answers here without some additional work and probably discussion on the jython-dev mailing list.
msg8514 (view) Author: Jim Baker (zyasoft) Date: 2014-05-22.00:07:13
We should deprecate and possibly remove dbexts.py for 2.7, based on the earlier analysis. Such packages really belong in PyPI now.
History
Date User Action Args
2014-10-07 00:19:19zyasoftsetpriority: low
2014-05-22 00:07:13zyasoftsetmessages: + msg8514
2013-02-20 18:45:15fwierzbickisetnosy: + fwierzbicki
versions: + Jython 2.5, - 2.5.1
2010-08-14 20:07:49zyasoftsetnosy: + zyasoft
messages: + msg5958
title: Suspected unicode problem in dbexts.py -> Encoding problems in dbexts.py - unicode, html
2010-02-09 15:08:08w_hungercreate