{"action":"created","issue":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/5499","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/5499/labels{/name}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/5499/comments","events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/5499/events","html_url":"https://github.com/matplotlib/matplotlib/issues/5499","id":117361194,"number":5499,"title":"UnicodeDecodeError in IPython Notebook caused by negative numbers in plt.legend()","user":{"login":"goulu","id":1368062,"avatar_url":"https://avatars.githubusercontent.com/u/1368062?v=3","gravatar_id":"","url":"https://api.github.com/users/goulu","html_url":"https://github.com/goulu","followers_url":"https://api.github.com/users/goulu/followers","following_url":"https://api.github.com/users/goulu/following{/other_user}","gists_url":"https://api.github.com/users/goulu/gists{/gist_id}","starred_url":"https://api.github.com/users/goulu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goulu/subscriptions","organizations_url":"https://api.github.com/users/goulu/orgs","repos_url":"https://api.github.com/users/goulu/repos","events_url":"https://api.github.com/users/goulu/events{/privacy}","received_events_url":"https://api.github.com/users/goulu/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-17T14:08:19Z","updated_at":"2015-11-17T14:45:04Z","closed_at":"2015-11-17T14:45:03Z","body":"Encountered a strange error shown in a small IPython Notebook here : https://gist.github.com/goulu/ba518d1a0a5267c0d3f3\r\n\r\nin the method _repr_svg_  method that generates a svg plot for IPython Notebook ( 2.7 kernel )\r\n\r\n    plt.legend()\r\n    savefig(output, format='svg')\r\n\r\ngenerates content like\r\n\r\n    <!-- \\xe2\\x88\\x925 --> \r\n\r\nfor \"-5\" in the legend, which causes a UnicodeDecodeError in JSON via Jupyter client"},"comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/157389577","html_url":"https://github.com/matplotlib/matplotlib/issues/5499#issuecomment-157389577","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/5499","id":157389577,"user":{"login":"goulu","id":1368062,"avatar_url":"https://avatars.githubusercontent.com/u/1368062?v=3","gravatar_id":"","url":"https://api.github.com/users/goulu","html_url":"https://github.com/goulu","followers_url":"https://api.github.com/users/goulu/followers","following_url":"https://api.github.com/users/goulu/following{/other_user}","gists_url":"https://api.github.com/users/goulu/gists{/gist_id}","starred_url":"https://api.github.com/users/goulu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goulu/subscriptions","organizations_url":"https://api.github.com/users/goulu/orgs","repos_url":"https://api.github.com/users/goulu/repos","events_url":"https://api.github.com/users/goulu/events{/privacy}","received_events_url":"https://api.github.com/users/goulu/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T14:45:03Z","updated_at":"2015-11-17T14:45:03Z","body":"I used BytesIO because the same rendering method also generates png, but I'll definitely have a look at StringIO, thanks.\r\n\r\nIn the meantime I solved my problem by adding a .decode('utf-8') at the end of the _repr_svg_ method. Sorry for the noise ..."}}