Comment 10 for bug 944761

Revision history for this message
Valentin Lab (vaab) wrote :

This fix seems straightforward, but It seems more a hack than the correct fix. Here's why:

- your solution changes the type of res["arch"], it is not anymore a "utf-8" encoded string but a unicode. This will lead to other bugs of this sort as everywhere res["arch"] is encoded in "utf-8".

- res["arch"] is always encoded in "utf-8". This is due to "osv/orm.py". So no surprises here. But, there are no obvious way to tell that ``search_extended`` is unicode by looking to the code as it is build from simple strings (which are not unicode) in python and gets casted in unicode by side-effect. This is obviously what caused the original programmer to let this bug through.

- You can also note that in openobject-server, the habits are to encode unicode strings before using them. The "encode" function I use came directly from there.

For these reasons, it seemed much better to propose my patch at:
https://code.launchpad.net/~vaab/openobject-addons/6.1-fix-project-gtd-encoding-issue-5/+merge/99998

I'm open to any discussion on the topic, and will accept any fix on this code. I'll appreciate any comments on the topics I've brought up. Thank you for reading.