{"action":"created","issue":{"url":"https://api.github.com/repos/elpaso/qgis-formawarevaluerelationwidget/issues/6","repository_url":"https://api.github.com/repos/elpaso/qgis-formawarevaluerelationwidget","labels_url":"https://api.github.com/repos/elpaso/qgis-formawarevaluerelationwidget/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/elpaso/qgis-formawarevaluerelationwidget/issues/6/comments","events_url":"https://api.github.com/repos/elpaso/qgis-formawarevaluerelationwidget/issues/6/events","html_url":"https://github.com/elpaso/qgis-formawarevaluerelationwidget/issues/6","id":153231455,"number":6,"title":"UnicodeEncodeError","user":{"login":"mterente","id":15198855,"avatar_url":"https://avatars.githubusercontent.com/u/15198855?v=3","gravatar_id":"","url":"https://api.github.com/users/mterente","html_url":"https://github.com/mterente","followers_url":"https://api.github.com/users/mterente/followers","following_url":"https://api.github.com/users/mterente/following{/other_user}","gists_url":"https://api.github.com/users/mterente/gists{/gist_id}","starred_url":"https://api.github.com/users/mterente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mterente/subscriptions","organizations_url":"https://api.github.com/users/mterente/orgs","repos_url":"https://api.github.com/users/mterente/repos","events_url":"https://api.github.com/users/mterente/events{/privacy}","received_events_url":"https://api.github.com/users/mterente/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-05T13:24:28Z","updated_at":"2016-05-05T14:04:33Z","closed_at":null,"body":"Hello Allesandro,\r\n\r\nI am using the widget on a table that has Unicode characters in Value column and I get this error:\r\n```\r\n2016-05-05T16:00:04\t1\tTraceback (most recent call last):\r\n\t\t\t  File \"C:/Users/mihai.terente/.qgis2/python/plugins\\FormAwareValueRelationWidget\\FormAwareValueRelationWidget.py\", line 297, in initWidget\r\n\t\t\t    self.populateWidget(editor)\r\n\t\t\t  File \"C:/Users/mihai.terente/.qgis2/python/plugins\\FormAwareValueRelationWidget\\FormAwareValueRelationWidget.py\", line 359, in populateWidget\r\n\t\t\t    cache = [(str(f.attributes()[self.key_index]), str(f.attributes()[self.value_index])) for f in self.mCache]\r\n\t\t\tUnicodeEncodeError: 'ascii' codec can't encode character u'\\u0218' in position 5: ordinal not in range(128)\r\n```\r\nThe character `'\\u0218'` is the letter `'Ș'`, a very common one in Romanian.\r\nHowever, the error is not critical, since the values are correctly saved.\r\n\r\nCould you look, please?\r\n\r\n\r\nThank you,\r\nMihai"},"comment":{"url":"https://api.github.com/repos/elpaso/qgis-formawarevaluerelationwidget/issues/comments/217163196","html_url":"https://github.com/elpaso/qgis-formawarevaluerelationwidget/issues/6#issuecomment-217163196","issue_url":"https://api.github.com/repos/elpaso/qgis-formawarevaluerelationwidget/issues/6","id":217163196,"user":{"login":"mterente","id":15198855,"avatar_url":"https://avatars.githubusercontent.com/u/15198855?v=3","gravatar_id":"","url":"https://api.github.com/users/mterente","html_url":"https://github.com/mterente","followers_url":"https://api.github.com/users/mterente/followers","following_url":"https://api.github.com/users/mterente/following{/other_user}","gists_url":"https://api.github.com/users/mterente/gists{/gist_id}","starred_url":"https://api.github.com/users/mterente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mterente/subscriptions","organizations_url":"https://api.github.com/users/mterente/orgs","repos_url":"https://api.github.com/users/mterente/repos","events_url":"https://api.github.com/users/mterente/events{/privacy}","received_events_url":"https://api.github.com/users/mterente/received_events","type":"User","site_admin":false},"created_at":"2016-05-05T14:04:33Z","updated_at":"2016-05-05T14:04:33Z","body":"Well... Not quite...\r\nThe above mentioned solution works if I open the layer form.\r\nIf I use relations, and the form is embedded within the form of another layer, the error comes back:\r\n```\r\n2016-05-05T16:55:58\t1\tTraceback (most recent call last):\r\n\t\t\t  File \"C:/Users/mihai.terente/.qgis2/python/plugins\\FormAwareValueRelationWidget\\FormAwareValueRelationWidget.py\", line 297, in initWidget\r\n\t\t\t    self.populateWidget(editor)\r\n\t\t\t  File \"C:/Users/mihai.terente/.qgis2/python/plugins\\FormAwareValueRelationWidget\\FormAwareValueRelationWidget.py\", line 359, in populateWidget\r\n\t\t\t    cache = [(unicode(f.attributes()[self.key_index]), unicode(f.attributes()[self.value_index])) for f in self.mCache]\r\n\t\t\tUnicodeEncodeError: 'ascii' codec can't encode character u'\\u0218' in position 5: ordinal not in range(128)\r\n```\r\nand now it has a critical behaviour: it removes the value that has the Unicode character from the attribute table.\r\n\r\n"}}