{"action":"created","issue":{"url":"https://api.github.com/repos/jasonrbriggs/stomp.py/issues/31","labels_url":"https://api.github.com/repos/jasonrbriggs/stomp.py/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/jasonrbriggs/stomp.py/issues/31/comments","events_url":"https://api.github.com/repos/jasonrbriggs/stomp.py/issues/31/events","html_url":"https://github.com/jasonrbriggs/stomp.py/pull/31","id":67763663,"number":31,"title":"Don't attempt to parse message payloads as UTF-8.","user":{"login":"grundleborg","id":1198059,"avatar_url":"https://avatars.githubusercontent.com/u/1198059?v=3","gravatar_id":"","url":"https://api.github.com/users/grundleborg","html_url":"https://github.com/grundleborg","followers_url":"https://api.github.com/users/grundleborg/followers","following_url":"https://api.github.com/users/grundleborg/following{/other_user}","gists_url":"https://api.github.com/users/grundleborg/gists{/gist_id}","starred_url":"https://api.github.com/users/grundleborg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grundleborg/subscriptions","organizations_url":"https://api.github.com/users/grundleborg/orgs","repos_url":"https://api.github.com/users/grundleborg/repos","events_url":"https://api.github.com/users/grundleborg/events{/privacy}","received_events_url":"https://api.github.com/users/grundleborg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-11T09:48:36Z","updated_at":"2015-07-09T23:16:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jasonrbriggs/stomp.py/pulls/31","html_url":"https://github.com/jasonrbriggs/stomp.py/pull/31","diff_url":"https://github.com/jasonrbriggs/stomp.py/pull/31.diff","patch_url":"https://github.com/jasonrbriggs/stomp.py/pull/31.patch"},"body":"STOMP messages can legitimately be binary, which fails to decode\r\nas UTF-8. On python 2, no decoding is attempted, but on python 3\r\nthe code attempts to decode the entire frame as UTF-8, which fails\r\nif the binary data contains invalid UTF-8 sequences.\r\n\r\nThis PR is tested on python 2.7 and 3.4 and works fine. However, on python 3 it changes the message body that is returned from being a string to a bytes. This is necessary because otherwise there's no way of getting a binary message payload out of the library. However it's not backwards compatible with existing users of the library on python 3 who expect a string for the message payload. I'm not sure what is the best way of dealing with this.\r\n\r\nPerhaps we need a flag passed to the Stomp object (or perhaps on subscribing to a channel, since different channels can contain different types of data) which sets the behaviour as assuming UTF-8 or assuming binary, and default to UTF-8 on python 3 to match the current behaviour?"},"comment":{"url":"https://api.github.com/repos/jasonrbriggs/stomp.py/issues/comments/120172257","html_url":"https://github.com/jasonrbriggs/stomp.py/pull/31#issuecomment-120172257","issue_url":"https://api.github.com/repos/jasonrbriggs/stomp.py/issues/31","id":120172257,"user":{"login":"jasonrbriggs","id":1325766,"avatar_url":"https://avatars.githubusercontent.com/u/1325766?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonrbriggs","html_url":"https://github.com/jasonrbriggs","followers_url":"https://api.github.com/users/jasonrbriggs/followers","following_url":"https://api.github.com/users/jasonrbriggs/following{/other_user}","gists_url":"https://api.github.com/users/jasonrbriggs/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonrbriggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonrbriggs/subscriptions","organizations_url":"https://api.github.com/users/jasonrbriggs/orgs","repos_url":"https://api.github.com/users/jasonrbriggs/repos","events_url":"https://api.github.com/users/jasonrbriggs/events{/privacy}","received_events_url":"https://api.github.com/users/jasonrbriggs/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T23:16:39Z","updated_at":"2015-07-09T23:16:39Z","body":"Should have replied to this ages ago. My apologies.\r\n\r\nI think the simplest option is a parameter to the connection for auto-decoding messages back from the message broker. That preserves the current behaviour.  Default it to True for the moment, then after a few releases, switch it off (and eventually remove).\r\n\r\nI've implemented that now on top of your pull request (merging shortly)."}}