{"action":"created","issue":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/3420","repository_url":"https://api.github.com/repos/mne-tools/mne-python","labels_url":"https://api.github.com/repos/mne-tools/mne-python/issues/3420/labels{/name}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/issues/3420/comments","events_url":"https://api.github.com/repos/mne-tools/mne-python/issues/3420/events","html_url":"https://github.com/mne-tools/mne-python/issues/3420","id":165307824,"number":3420,"title":"Bug on import of EDF files with accentuated annotations","user":{"login":"deep-introspection","id":208779,"avatar_url":"https://avatars.githubusercontent.com/u/208779?v=3","gravatar_id":"","url":"https://api.github.com/users/deep-introspection","html_url":"https://github.com/deep-introspection","followers_url":"https://api.github.com/users/deep-introspection/followers","following_url":"https://api.github.com/users/deep-introspection/following{/other_user}","gists_url":"https://api.github.com/users/deep-introspection/gists{/gist_id}","starred_url":"https://api.github.com/users/deep-introspection/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deep-introspection/subscriptions","organizations_url":"https://api.github.com/users/deep-introspection/orgs","repos_url":"https://api.github.com/users/deep-introspection/repos","events_url":"https://api.github.com/users/deep-introspection/events{/privacy}","received_events_url":"https://api.github.com/users/deep-introspection/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mne-tools/mne-python/labels/BUG","name":"BUG","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2016-07-13T12:25:14Z","updated_at":"2016-07-20T09:56:42Z","closed_at":null,"body":"Hey!\r\nSo importing an EDF file, I have a crash\r\n> ValueError: byte must be in range(0, 256)\r\n\r\noccuring at this level: https://github.com/mne-tools/mne-python/blob/f04d1460d10ebe3b9466ccad9c077040d42a6d5f/mne/io/edf/edf.py#L258\r\n\r\nDigging into the code, I realize that the (French) people who have recorded the EEG may have put characters with accents.\r\n\r\nBy changing the above part of the code to :\r\n```\r\ntry:\r\n    tals.extend([i % 256, i // 256])\r\nexcept:\r\n    print i, tals[10:].decode('ascii', 'ignore')\r\n    raise('DEBUG')\r\n```\r\nI obtained this:\r\n> -5779 0000+44+1166PHOTO 0.5Hz+45+1172+1172.200000+46+1172Yeux ouverts+47+1178+1178.840000+48+1178Yeux fer\r\n\r\nIt's indeed French, and the error occurs exactly at the level of the annotation **Yeux fer** **_mé_** (if you take i = -5779, the i % 256 gives '**m**', so I assume the original second character causing the bug was '**é**'...\r\n\r\nSo, what should be the best way to handle this?\r\n\r\nThanks!\r\nGuillaume"},"comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/comments/233905510","html_url":"https://github.com/mne-tools/mne-python/issues/3420#issuecomment-233905510","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/3420","id":233905510,"user":{"login":"jaeilepp","id":3456414,"avatar_url":"https://avatars.githubusercontent.com/u/3456414?v=3","gravatar_id":"","url":"https://api.github.com/users/jaeilepp","html_url":"https://github.com/jaeilepp","followers_url":"https://api.github.com/users/jaeilepp/followers","following_url":"https://api.github.com/users/jaeilepp/following{/other_user}","gists_url":"https://api.github.com/users/jaeilepp/gists{/gist_id}","starred_url":"https://api.github.com/users/jaeilepp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaeilepp/subscriptions","organizations_url":"https://api.github.com/users/jaeilepp/orgs","repos_url":"https://api.github.com/users/jaeilepp/repos","events_url":"https://api.github.com/users/jaeilepp/events{/privacy}","received_events_url":"https://api.github.com/users/jaeilepp/received_events","type":"User","site_admin":false},"created_at":"2016-07-20T09:56:42Z","updated_at":"2016-07-20T09:56:42Z","body":"I don't have the code with me now, but I remember it being quite hackish. I think I checked the range in two places, so probably a check before line 16 in edf.py will do it."}}
{"actor":{"display_login":"jaeilepp"}}