python-wordpress-xmlrpc
python-wordpress-xmlrpc copied to clipboard
WordPressBase __repr__ needs revision
In order to represent an Object the system do:
- Return a property string from
WordPressChildClass.__str__
- Convert
self.__str__
to ascii (str(self)
) - Convert ascii
self
to utf-8 (.encode('UTF-8')
)
Which IMHO is totally wrong because:
- the majority of wordpress blogs defaults to UTF-8 data - and it can't be fully converted to ascii.
- if converting to ascii, why bring back to utf-8?
I'm currently not sure if any unicode
conversion is made in the request/response processes (the data [eg. self.title] is already unicode, which is great).
That being said the fix I've used is this commit. But I have also make sure to convert all the classes.str output to utf-8.
In fact I'm really not sure if converting all data to utf-8 will catch all WP encoding cases (surely most of them). There is some info about encodings and WordPress in the following links
- WPDB Class: http://www.tig12.net/downloads/apidocs/wp/wp-includes/wpdb.class.html#det_fields_charset
- http://hakre.wordpress.com/2010/12/26/wordpress-database-charset-and-collation-configuration/