{"action":"created","issue":{"url":"https://api.github.com/repos/ttempe/chinese-support-addon/issues/62","labels_url":"https://api.github.com/repos/ttempe/chinese-support-addon/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/ttempe/chinese-support-addon/issues/62/comments","events_url":"https://api.github.com/repos/ttempe/chinese-support-addon/issues/62/events","html_url":"https://github.com/ttempe/chinese-support-addon/issues/62","id":110742563,"number":62,"title":"Character causes plugin to fail","user":{"login":"cherryleafroad","id":13651622,"avatar_url":"https://avatars.githubusercontent.com/u/13651622?v=3","gravatar_id":"","url":"https://api.github.com/users/cherryleafroad","html_url":"https://github.com/cherryleafroad","followers_url":"https://api.github.com/users/cherryleafroad/followers","following_url":"https://api.github.com/users/cherryleafroad/following{/other_user}","gists_url":"https://api.github.com/users/cherryleafroad/gists{/gist_id}","starred_url":"https://api.github.com/users/cherryleafroad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cherryleafroad/subscriptions","organizations_url":"https://api.github.com/users/cherryleafroad/orgs","repos_url":"https://api.github.com/users/cherryleafroad/repos","events_url":"https://api.github.com/users/cherryleafroad/events{/privacy}","received_events_url":"https://api.github.com/users/cherryleafroad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-09T21:55:55Z","updated_at":"2015-11-19T17:52:07Z","closed_at":null,"body":"Note: I got these characters from a course on memrise. I suspect that there's something different with these characters which are causing these strange problems. Consequently, I also cannot use the fill in missing fields feature, probably because of this.\r\n\r\nA certain character, ⺌, ⺍ (not sure why this one is a box, try putting it in Google Translator and the character will show up. English->Chinese), is causing the plugin to fail for me.\r\n\r\nThe error happens when I am in the browser and viewing all my cards. I enable the plugin by clicking the button, click the Hanzi field, then click the next field, and this error pops up.\r\n\r\n```\r\nAn error occurred in an add-on.\r\nPlease post on the add-on forum:\r\nhttps://anki.tenderapp.com/discussions/add-ons\r\n\r\nTraceback (most recent call last):\r\n  File \"C:\\cygwin\\home\\dae\\win\\build\\pyi.win32\\anki\\outPYZ1.pyz/aqt.webview\", line 18, in run\r\n  File \"C:\\cygwin\\home\\dae\\win\\build\\pyi.win32\\anki\\outPYZ1.pyz/aqt.editor\", line 462, in bridge\r\n  File \"C:\\cygwin\\home\\dae\\win\\build\\pyi.win32\\anki\\outPYZ1.pyz/anki.hooks\", line 32, in runFilter\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit.py\", line 47, in on_focus_lost\r\n    edit_behavior.update_fields(efields, updated_field, model_name, model_type)\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit_behavior.py\", line 523, in update_fields\r\n    update_all_Transcription_fields(field[updated_field], field)\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit_behavior.py\", line 271, in update_all_Transcription_fields\r\n    update_Bopomofo_fields(hanzi, dico)\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit_behavior.py\", line 258, in update_Bopomofo_fields\r\n    t = colorize( transcribe( no_sound( hanzi ), \"Bopomofo\") )\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit_functions.py\", line 270, in transcribe\r\n    r = bopomofo_module.bopomofo(no_accents(r))\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit_functions.py\", line 162, in no_accents\r\n    if len(text)==0:\r\nTypeError: object of type 'NoneType' has no len()\r\n```\r\n\r\nAnother character (龵) (yes, the character looks blank for some reason; paste it into Google translate) causes it to fail with a different error:\r\n\r\n```\r\nAn error occurred in an add-on.\r\nPlease post on the add-on forum:\r\nhttps://anki.tenderapp.com/discussions/add-ons\r\n\r\nTraceback (most recent call last):\r\n  File \"C:\\cygwin\\home\\dae\\win\\build\\pyi.win32\\anki\\outPYZ1.pyz/aqt.webview\", line 18, in run\r\n  File \"C:\\cygwin\\home\\dae\\win\\build\\pyi.win32\\anki\\outPYZ1.pyz/aqt.editor\", line 462, in bridge\r\n  File \"C:\\cygwin\\home\\dae\\win\\build\\pyi.win32\\anki\\outPYZ1.pyz/anki.hooks\", line 32, in runFilter\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit.py\", line 47, in on_focus_lost\r\n    edit_behavior.update_fields(efields, updated_field, model_name, model_type)\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit_behavior.py\", line 523, in update_fields\r\n    update_all_Transcription_fields(field[updated_field], field)\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit_behavior.py\", line 267, in update_all_Transcription_fields\r\n    update_Transcription_fields(hanzi, dico)\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit_behavior.py\", line 187, in update_Transcription_fields\r\n    t = colorize( transcribe( no_sound( hanzi ) ) )\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit_functions.py\", line 56, in colorize\r\n    text = re.sub(u'([\\u3400-\\u9fff])', colorize_hanzi_sub, text)\r\n  File \"C:\\cygwin\\home\\dae\\win\\build\\pyi.win32\\anki\\outPYZ1.pyz/re\", line 151, in sub\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit_functions.py\", line 37, in colorize_hanzi_sub\r\n    return u'<span class=\"tone{t}\">{r}</span>'.format(t=get_tone_number(transcribe(p.group(1), only_one=True)), r=p.group())\r\n  File \"D:\\Users\\user\\Documents\\Anki\\addons\\chinese\\edit_functions.py\", line 636, in get_tone_number\r\n    if re.match(r\".+1[0-9]$\", pinyin):\r\n  File \"C:\\cygwin\\home\\dae\\win\\build\\pyi.win32\\anki\\outPYZ1.pyz/re\", line 137, in match\r\nTypeError: expected string or buffer\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ttempe/chinese-support-addon/issues/comments/158135293","html_url":"https://github.com/ttempe/chinese-support-addon/issues/62#issuecomment-158135293","issue_url":"https://api.github.com/repos/ttempe/chinese-support-addon/issues/62","id":158135293,"user":{"login":"leezu","id":946903,"avatar_url":"https://avatars.githubusercontent.com/u/946903?v=3","gravatar_id":"","url":"https://api.github.com/users/leezu","html_url":"https://github.com/leezu","followers_url":"https://api.github.com/users/leezu/followers","following_url":"https://api.github.com/users/leezu/following{/other_user}","gists_url":"https://api.github.com/users/leezu/gists{/gist_id}","starred_url":"https://api.github.com/users/leezu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leezu/subscriptions","organizations_url":"https://api.github.com/users/leezu/orgs","repos_url":"https://api.github.com/users/leezu/repos","events_url":"https://api.github.com/users/leezu/events{/privacy}","received_events_url":"https://api.github.com/users/leezu/received_events","type":"User","site_admin":false},"created_at":"2015-11-19T17:52:07Z","updated_at":"2015-11-19T17:52:07Z","body":"I'm getting a similar error with some letters (e.g. 㣽, 㚢). Actually I was just trying to figure out how to type the u umlaut (ü) character to write the letter 女.\r\n\r\nAfter several tries with those erroneous characters Anki gave errors as well when I tried to enter 女. Only restart of the program made it work again.\r\n\r\nTraceback:\r\nTraceback (most recent call last):\r\n  File \"/usr/share/anki/aqt/progress.py\", line 69, in handler\r\n    func()\r\n  File \"/usr/share/anki/aqt/editor.py\", line 466, in onUpdate\r\n    self.loadNote()\r\n  File \"/usr/share/anki/anki/hooks.py\", line 55, in repl\r\n    old(*args, **kwargs)\r\n  File \"/usr/share/anki/aqt/editor.py\", line 538, in loadNote\r\n    data.append((fld, self.mw.col.media.escapeImages(val)))\r\n  File \"/usr/share/anki/anki/media.py\", line 237, in escapeImages\r\n    string = re.sub(reg, repl, string)\r\n  File \"/usr/lib/python2.7/re.py\", line 155, in sub\r\n    return _compile(pattern, flags).sub(repl, string, count)\r\nTypeError: expected string or buffer"}}