{"action":"created","issue":{"url":"https://api.github.com/repos/IronLanguages/main/issues/1331","repository_url":"https://api.github.com/repos/IronLanguages/main","labels_url":"https://api.github.com/repos/IronLanguages/main/issues/1331/labels{/name}","comments_url":"https://api.github.com/repos/IronLanguages/main/issues/1331/comments","events_url":"https://api.github.com/repos/IronLanguages/main/issues/1331/events","html_url":"https://github.com/IronLanguages/main/pull/1331","id":171584255,"number":1331,"title":"Do not try to encode strings passed to the str() constructor (#1108)","user":{"login":"kunom","id":1832956,"avatar_url":"https://avatars.githubusercontent.com/u/1832956?v=3","gravatar_id":"","url":"https://api.github.com/users/kunom","html_url":"https://github.com/kunom","followers_url":"https://api.github.com/users/kunom/followers","following_url":"https://api.github.com/users/kunom/following{/other_user}","gists_url":"https://api.github.com/users/kunom/gists{/gist_id}","starred_url":"https://api.github.com/users/kunom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kunom/subscriptions","organizations_url":"https://api.github.com/users/kunom/orgs","repos_url":"https://api.github.com/users/kunom/repos","events_url":"https://api.github.com/users/kunom/events{/privacy}","received_events_url":"https://api.github.com/users/kunom/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-17T06:30:15Z","updated_at":"2016-08-18T10:05:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/IronLanguages/main/pulls/1331","html_url":"https://github.com/IronLanguages/main/pull/1331","diff_url":"https://github.com/IronLanguages/main/pull/1331.diff","patch_url":"https://github.com/IronLanguages/main/pull/1331.patch"},"body":"See issue #1108."},"comment":{"url":"https://api.github.com/repos/IronLanguages/main/issues/comments/240680507","html_url":"https://github.com/IronLanguages/main/pull/1331#issuecomment-240680507","issue_url":"https://api.github.com/repos/IronLanguages/main/issues/1331","id":240680507,"user":{"login":"paweljasinski","id":1618400,"avatar_url":"https://avatars.githubusercontent.com/u/1618400?v=3","gravatar_id":"","url":"https://api.github.com/users/paweljasinski","html_url":"https://github.com/paweljasinski","followers_url":"https://api.github.com/users/paweljasinski/followers","following_url":"https://api.github.com/users/paweljasinski/following{/other_user}","gists_url":"https://api.github.com/users/paweljasinski/gists{/gist_id}","starred_url":"https://api.github.com/users/paweljasinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paweljasinski/subscriptions","organizations_url":"https://api.github.com/users/paweljasinski/orgs","repos_url":"https://api.github.com/users/paweljasinski/repos","events_url":"https://api.github.com/users/paweljasinski/events{/privacy}","received_events_url":"https://api.github.com/users/paweljasinski/received_events","type":"User","site_admin":false},"created_at":"2016-08-18T10:05:56Z","updated_at":"2016-08-18T10:05:56Z","body":"I have put together a test and run under cpython, ipy with this PR and jython.\r\n```\r\n# -*- coding: utf-8 -*-\r\ns = str(\"ä\")\r\nprint len(s)\r\nfor c in s:\r\n    print \"%x\" % ord(c)\r\n\r\nprint\r\ns = str(\"\\xc3\\xa4\")\r\nprint len(s)\r\nfor c in s:\r\n    print \"%x\" % ord(c)\r\n\r\nprint\r\nclass A(str):\r\n    pass\r\ns = A(\"ä\")\r\nprint len(s)\r\nfor c in s:\r\n    print \"%x\" % ord(c)\r\n\r\n# throws under cpython and jython, ok under ipy\r\ns = str(u\"ä\")\r\n```\r\n\r\ncpython\r\n```\r\n$ python /home/rejap/tmp/str2.py\r\n2\r\nc3\r\na4\r\n\r\n2\r\nc3\r\na4\r\n\r\n2\r\nc3\r\na4\r\nTraceback (most recent call last):\r\n  File \"/home/rejap/tmp/str2.py\", line 22, in <module>\r\n    s = str(u\"ä\")\r\nUnicodeEncodeError: 'ascii' codec can't encode character u'\\xe4' in position 0: ordinal not in range(128)\r\n```\r\n\r\nipy\r\n```\r\n1\r\ne4\r\n\r\n2\r\nc3\r\na4\r\n\r\n1\r\ne4\r\n```\r\n\r\njython\r\n```\r\n2\r\nc3\r\na4\r\n\r\n2\r\nc3\r\na4\r\n\r\n2\r\nc3\r\na4\r\nTraceback (most recent call last):\r\n  File \"c:/cygwin64/home/rejap/tmp/str2.py\", line 22, in <module>\r\n    s = str(u\"\\xc3\\xa4\")\r\nUnicodeEncodeError: 'ascii' codec can't encode character u'\\xe4' in position 0: ordinal not in range(128)\r\n```\r\n\r\neven though the results are not consistent, particularly missing exception in our case. I have a feeling that merging would improve the situation.\r\nAt the same time, jython appears to address it better than ipy does, so probably things can be done better."}}
{"actor":{"display_login":"paweljasinski"}}