dabo Commit
Revision 7277
Date: 2012-10-11 12:13:53 -0700 (Thu, 11 Oct 2012)
Author: Paul
Trac: http://trac.dabodev.com/changeset/7277
Changed:
U trunk/dabo/lib/reportWriter.py
Log:
r7130 fixed a problem on Windows displaying the Euro symbol on Windows
(UnicodeDecodeError
coming up from reportlab). However, it turns out that the fix resulted in other
unicode
strings not displaying correctly (garbage characters added).
I'm not proud of this commit: I have no more time to try to work out what is
happening,
but it does fix both problems. Basically, I reverted r7130 and then wrapped the
reportlab draw() call in a try block catching for UnicodeDecodeError, and if it
happens run
the string through dabo.lib.ustr().
Diff:
Modified: trunk/dabo/lib/reportWriter.py
===================================================================
--- trunk/dabo/lib/reportWriter.py 2012-10-10 04:19:06 UTC (rev 7276)
+++ trunk/dabo/lib/reportWriter.py 2012-10-11 19:13:53 UTC (rev 7277)
@@ -1634,9 +1634,24 @@
s = self.NoneDisplay
elif obj.Report.getProp("StringifyDates") and
isinstance(s, datetime.date):
s = getStringFromDate(s)
+ if isinstance(s, unicode):
+ pass
+ elif isinstance(s, str):
+ try:
+ s = unicode(s, "utf-8")
+ except UnicodeDecodeError:
+ try:
+ s = unicode(s, self.Encoding)
+ except UnicodeDecodeError:
+ # s must have already been
encoded, and the default encoding is ascii.
+ pass
+ else:
+ s = unicode(s)
+ try:
+ func(posx, 0, s)
+ except UnicodeDecodeError:
+ func(posx, 0, ustr(s))
- func(posx, 0, ustr(s))
-
elif objType in ("Frameset", "Memo"):
# Frameset is deprecated; Memo is what to use now. Memo
abstracts away the
# Frame/Paragraph hierarchy into one single report
object.
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]