Hi,

I've done several fixes for Unicode issues lately, and while I can't be sure
that everything works now, I think we're nearly there.

There is still one place where we do conversion from str objects to
unicode objects, when we don't know nothing about those str objects.
We then assume that there are UTF-8 encoded (this is r3084).

I think we should always know or make clear what is the encoding.
If we really don't know, then we should not assume UTF-8 (which
may or may not work, who knows), but rather use some "catch all"
conversion (trac.util.to_unicode, namely).

Therefore, we should revert r3084 and instead do the following in
HDFWrapper.add_value:


Index: clearsilver.py
===================================================================
--- clearsilver.py    (revision 3106)
+++ clearsilver.py    (working copy)
@@ -15,7 +15,7 @@
# Author: Christopher Lenz <[EMAIL PROTECTED]>

from trac.core import TracError
-from trac.util import markup
+from trac.util import markup, to_unicode


class HDFWrapper:
@@ -220,7 +220,7 @@
                set_unicode(prefix, unicode(value))
            elif isinstance(value, str):
                if escape:
-                    set_unicode(prefix, markup.escape(value))
+                    set_unicode(prefix, markup.escape(to_unicode(value)))
                else:
                    set_str(prefix, value)
            elif isinstance(value, unicode):


Note: trac.util.to_unicode was introduced in r3092
(http://projects.edgewall.com/trac/browser/trunk/trac/util/__init__.py?rev=3106#L72)


-- Christian
_______________________________________________
Trac-dev mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-dev

Reply via email to