{"action":"created","issue":{"url":"https://api.github.com/repos/DataDog/dd-agent/issues/1256","labels_url":"https://api.github.com/repos/DataDog/dd-agent/issues/1256/labels{/name}","comments_url":"https://api.github.com/repos/DataDog/dd-agent/issues/1256/comments","events_url":"https://api.github.com/repos/DataDog/dd-agent/issues/1256/events","html_url":"https://github.com/DataDog/dd-agent/issues/1256","id":52610207,"number":1256,"title":"[dogstatsd] events payload does not support utf-8 properly","user":{"login":"oderwat","id":719156,"avatar_url":"https://avatars.githubusercontent.com/u/719156?v=3","gravatar_id":"","url":"https://api.github.com/users/oderwat","html_url":"https://github.com/oderwat","followers_url":"https://api.github.com/users/oderwat/followers","following_url":"https://api.github.com/users/oderwat/following{/other_user}","gists_url":"https://api.github.com/users/oderwat/gists{/gist_id}","starred_url":"https://api.github.com/users/oderwat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oderwat/subscriptions","organizations_url":"https://api.github.com/users/oderwat/orgs","repos_url":"https://api.github.com/users/oderwat/repos","events_url":"https://api.github.com/users/oderwat/events{/privacy}","received_events_url":"https://api.github.com/users/oderwat/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/DataDog/dd-agent/labels/bugfix","name":"bugfix","color":"eb6420"},{"url":"https://api.github.com/repos/DataDog/dd-agent/labels/dogstatsd","name":"dogstatsd","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"LeoCavaille","id":1788830,"avatar_url":"https://avatars.githubusercontent.com/u/1788830?v=3","gravatar_id":"","url":"https://api.github.com/users/LeoCavaille","html_url":"https://github.com/LeoCavaille","followers_url":"https://api.github.com/users/LeoCavaille/followers","following_url":"https://api.github.com/users/LeoCavaille/following{/other_user}","gists_url":"https://api.github.com/users/LeoCavaille/gists{/gist_id}","starred_url":"https://api.github.com/users/LeoCavaille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeoCavaille/subscriptions","organizations_url":"https://api.github.com/users/LeoCavaille/orgs","repos_url":"https://api.github.com/users/LeoCavaille/repos","events_url":"https://api.github.com/users/LeoCavaille/events{/privacy}","received_events_url":"https://api.github.com/users/LeoCavaille/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/DataDog/dd-agent/milestones/38","labels_url":"https://api.github.com/repos/DataDog/dd-agent/milestones/38/labels","id":804808,"number":38,"title":"5.2.0","description":null,"creator":{"login":"remh","id":1311477,"avatar_url":"https://avatars.githubusercontent.com/u/1311477?v=3","gravatar_id":"","url":"https://api.github.com/users/remh","html_url":"https://github.com/remh","followers_url":"https://api.github.com/users/remh/followers","following_url":"https://api.github.com/users/remh/following{/other_user}","gists_url":"https://api.github.com/users/remh/gists{/gist_id}","starred_url":"https://api.github.com/users/remh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remh/subscriptions","organizations_url":"https://api.github.com/users/remh/orgs","repos_url":"https://api.github.com/users/remh/repos","events_url":"https://api.github.com/users/remh/events{/privacy}","received_events_url":"https://api.github.com/users/remh/received_events","type":"User","site_admin":false},"open_issues":51,"closed_issues":55,"state":"open","created_at":"2014-09-26T21:43:30Z","updated_at":"2015-01-05T14:50:01Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2014-12-21T23:48:34Z","updated_at":"2015-01-05T15:07:57Z","closed_at":null,"body":"I try to extend my own datadog php interface with async events over dd-agent. It works very nice but I can't use utf-8 encoding?\r\n\r\n```\r\n2014-12-22 00:03:53 CET | ERROR | dd.dogstatsd | dogstatsd(dogstatsd.py:306) | Error receiving datagram\r\nTraceback (most recent call last):\r\n  File \"/opt/datadog-agent/agent/dogstatsd.py\", line 294, in start\r\n    aggregator_submit(message)\r\n  File \"/home/opt-extra/datadog-agent/agent/aggregator.py\", line 508, in submit_packets\r\n    event = self.parse_event_packet(packet)\r\n  File \"/home/opt-extra/datadog-agent/agent/aggregator.py\", line 498, in parse_event_packet\r\n    raise Exception(u'Unparseable event packet: %s' % packet)\r\nUnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 40: ordinal not in range(128)\r\n```\r\nAs far as I can see the related python code is in aggregator.py line 471 (https://github.com/DataDog/dd-agent/blob/master/aggregator.py#L471) which uses \"unicode(str)\". Looking up the python documentation it says this converts something to unicode and because it has no second parameter it just understands \"ascii\" as source. I also see that there was a change of this line while implementing the alert functionality. Why?\r\n\r\nI think if there is no utf-8 by default one should be able to add an encoding to the metadata part of the message."},"comment":{"url":"https://api.github.com/repos/DataDog/dd-agent/issues/comments/68719911","html_url":"https://github.com/DataDog/dd-agent/issues/1256#issuecomment-68719911","issue_url":"https://api.github.com/repos/DataDog/dd-agent/issues/1256","id":68719911,"user":{"login":"LeoCavaille","id":1788830,"avatar_url":"https://avatars.githubusercontent.com/u/1788830?v=3","gravatar_id":"","url":"https://api.github.com/users/LeoCavaille","html_url":"https://github.com/LeoCavaille","followers_url":"https://api.github.com/users/LeoCavaille/followers","following_url":"https://api.github.com/users/LeoCavaille/following{/other_user}","gists_url":"https://api.github.com/users/LeoCavaille/gists{/gist_id}","starred_url":"https://api.github.com/users/LeoCavaille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeoCavaille/subscriptions","organizations_url":"https://api.github.com/users/LeoCavaille/orgs","repos_url":"https://api.github.com/users/LeoCavaille/repos","events_url":"https://api.github.com/users/LeoCavaille/events{/privacy}","received_events_url":"https://api.github.com/users/LeoCavaille/received_events","type":"User","site_admin":false},"created_at":"2015-01-05T15:07:57Z","updated_at":"2015-01-05T15:07:57Z","body":"Confirmed, thanks for the report @oderwat. Handling utf8 should be the default, we should `decode` the string instead of using `unicode()` or make it an unicode more upstream in that code."}}