{"action":"created","issue":{"url":"https://api.github.com/repos/behave/behave/issues/396","repository_url":"https://api.github.com/repos/behave/behave","labels_url":"https://api.github.com/repos/behave/behave/issues/396/labels{/name}","comments_url":"https://api.github.com/repos/behave/behave/issues/396/comments","events_url":"https://api.github.com/repos/behave/behave/issues/396/events","html_url":"https://github.com/behave/behave/issues/396","id":127866235,"number":396,"title":"Problem with textutil in Assertation","user":{"login":"FZetting","id":16813860,"avatar_url":"https://avatars.githubusercontent.com/u/16813860?v=3","gravatar_id":"","url":"https://api.github.com/users/FZetting","html_url":"https://github.com/FZetting","followers_url":"https://api.github.com/users/FZetting/followers","following_url":"https://api.github.com/users/FZetting/following{/other_user}","gists_url":"https://api.github.com/users/FZetting/gists{/gist_id}","starred_url":"https://api.github.com/users/FZetting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FZetting/subscriptions","organizations_url":"https://api.github.com/users/FZetting/orgs","repos_url":"https://api.github.com/users/FZetting/repos","events_url":"https://api.github.com/users/FZetting/events{/privacy}","received_events_url":"https://api.github.com/users/FZetting/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/behave/behave/labels/unicode","name":"unicode","color":"eb6420"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-01-21T07:53:41Z","updated_at":"2016-07-19T15:25:06Z","closed_at":"2016-07-19T15:25:06Z","body":"The textutil.text(value, encoding=None, errors=None) returns an invalid message string for the raised Assertation when the string is like u'XXXXX\\\\01_XXXXX.feature:60.'.\r\nIt seems that the escaping and replacing in line 79 is the problem.\r\n\r\nThe code shows the problem separated.\r\n\r\nSystem Python 2.7.11. behave 1.2.5\r\n\r\n-------------------------------------------------------------------------------------------------------------\r\n    import re\r\n    import os\r\n    \r\n    import six\r\n    \r\n    strings = ['{0}'.format('XXXXX\\\\01_XXXXX.feature:60.'),\r\n               u'{0}'.format('XXXXX\\\\01_XXXXX.feature:60.'),\r\n              '{0}'.format('XXXXX\\\\XXXXX.feature:60.'),\r\n               u'{0}'.format('XXXXX\\\\XXXXX.feature:60.'),\r\n              ]\r\n    \r\n    \r\n    def raw_string(s):\r\n        if isinstance(s, str):\r\n            s = s.encode('string-escape')\r\n        elif isinstance(s, unicode):\r\n            s = s.encode('unicode-escape')\r\n        return s\r\n    \r\n    def path_escape(path_string):\r\n    \r\n        data = str(path_string)\r\n        text = six.text_type(data, \"unicode-escape\", \"replace\")\r\n        return text\r\n    \r\n    \r\n    if __name__ == '__main__':\r\n        for pos, name in enumerate(strings):\r\n            print pos, name\r\n            print pos, path_escape(name)\r\n            print pos, raw_string(path_escape(name))\r\n            print pos, raw_string(name)\r\n\r\n-------------------------------------------------------------------------------------------------------------\r\n\r\nFranz"},"comment":{"url":"https://api.github.com/repos/behave/behave/issues/comments/233668743","html_url":"https://github.com/behave/behave/issues/396#issuecomment-233668743","issue_url":"https://api.github.com/repos/behave/behave/issues/396","id":233668743,"user":{"login":"jenisys","id":371945,"avatar_url":"https://avatars.githubusercontent.com/u/371945?v=3","gravatar_id":"","url":"https://api.github.com/users/jenisys","html_url":"https://github.com/jenisys","followers_url":"https://api.github.com/users/jenisys/followers","following_url":"https://api.github.com/users/jenisys/following{/other_user}","gists_url":"https://api.github.com/users/jenisys/gists{/gist_id}","starred_url":"https://api.github.com/users/jenisys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenisys/subscriptions","organizations_url":"https://api.github.com/users/jenisys/orgs","repos_url":"https://api.github.com/users/jenisys/repos","events_url":"https://api.github.com/users/jenisys/events{/privacy}","received_events_url":"https://api.github.com/users/jenisys/received_events","type":"User","site_admin":false},"created_at":"2016-07-19T15:25:06Z","updated_at":"2016-07-19T15:25:06Z","body":"DUPLICATES: #336 \r\nNOTE: raw_string() implementation should not encode in both cases."}}
{"actor":{"display_login":"jenisys"}}