-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encode Error if title is encoded as unicode string #112
Comments
Thanks for the report. After some testing I can confirm that this is a bug in Python-Redmine. I know how to properly fix it once and for all, but this will require some internal library redesign and I don't have time to do this right now. Your workaround is perfectly fine, so please keep using it until this problem won't be fixed in Python-Redmine internally. |
I encountered the same problem while iterating wiki pages diff --git a/redmine/managers.py b/redmine/managers.py
index 81061ab..76e14ad 100644
--- a/redmine/managers.py
+++ b/redmine/managers.py
@@ -4,6 +4,7 @@ from distutils.version import LooseVersion
from .resultsets import ResourceSet
from .utilities import MemorizeFormatter
+from .utilities import to_string, is_string
from .exceptions import (
ResourceError,
ResourceBadMethodError,
@@ -118,7 +119,9 @@ class ResourceManager(object):
"""Returns a Resource object directly by resource id (can be either integer id or string identifier)"""
if self.resource_class.query_one is None or self.resource_class.container_one is None:
raise ResourceBadMethodError
+ if is_string(resource_id):
+ resource_id = to_string(resource_id)
try:
self.url = '{0}{1}'.format(self.redmine.url, self.resource_class.query_one.format(resource_id, **params))
except KeyError as exception: I understand that you care about code quality want to avoid this kind of patching |
All unicode issues should now be fixed in v1.5.1 @Digenis BTW, in your current case with wiki_pages you could use |
I have version 1.4.0 installed and I still have a similar bug when doing the following line (the string was loaded from another redmine installation via get before):
I got this error:
After further investigations, I found a workaround to convert the title to utf-8 before passing it to create. I am not sure if this is a good way and maybe the conversion should be made dependent on the data coming in.
The text was updated successfully, but these errors were encountered: