Issue 1637850: make_table in difflib does not work with unicode (original) (raw)
Issue1637850
Created on 2007-01-17 16:22 by y-unno, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Messages (3) | ||
|---|---|---|
| msg31059 - (view) | Author: y-unno (y-unno) | Date: 2007-01-17 16:22 |
| make_table function in difflib.HtmlDiff does not work correctly when input strings are unicode. This is because the library uses cStringIO.StringIO classes, and cStringIO.StringIO returns strings encoded by the default encoding. When the default encoding is 'ascii', for example, this behaviour becomes a problem because some unicode characters cannot be encoded in 'ascii'. So, please change cStringIO to StringIO in difflib.py. When I use StringIO in difflib.py, this function returns unicode strings and no problems occured. This problem occured in Python 2.5/2.4 on Windows XP. | ||
| msg31060 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2007-01-17 21:13 |
| I don't know. Perhaps we should rather fix cStringIO to accept Unicode strings. | ||
| msg31061 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2007-03-08 21:35 |
| Fixed in revs 54229 and 54230. It wasn't necessary to use StringIO at all. A simple list of strings and join works fine (and handles unicode transparently). |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:22 | admin | set | github: 44481 |
| 2007-01-17 16:22:22 | y-unno | create |
