{"action":"created","issue":{"url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/2069","repository_url":"https://api.github.com/repos/Valloric/YouCompleteMe","labels_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/2069/labels{/name}","comments_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/2069/comments","events_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/2069/events","html_url":"https://github.com/Valloric/YouCompleteMe/issues/2069","id":142446590,"number":2069,"title":"Particular character sequence in YAML or Python file throws \"UnicodeEncodeError: 'ascii' codec can't encode character u'\\u2019' in position 19: ordinal not in range(128)\"","user":{"login":"defionscode","id":4664162,"avatar_url":"https://avatars.githubusercontent.com/u/4664162?v=3","gravatar_id":"","url":"https://api.github.com/users/defionscode","html_url":"https://github.com/defionscode","followers_url":"https://api.github.com/users/defionscode/followers","following_url":"https://api.github.com/users/defionscode/following{/other_user}","gists_url":"https://api.github.com/users/defionscode/gists{/gist_id}","starred_url":"https://api.github.com/users/defionscode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/defionscode/subscriptions","organizations_url":"https://api.github.com/users/defionscode/orgs","repos_url":"https://api.github.com/users/defionscode/repos","events_url":"https://api.github.com/users/defionscode/events{/privacy}","received_events_url":"https://api.github.com/users/defionscode/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-21T19:25:40Z","updated_at":"2016-03-31T23:06:17Z","closed_at":null,"body":"# Issue Prelude\r\n\r\n**Please complete these steps and check these boxes (by putting an `x` inside\r\nthe brackets) _before_ filing your issue:**\r\n\r\n- [x] I have read and understood YCM's [CONTRIBUTING][cont] document.\r\n- [x] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.\r\n- [x] I have read and understood YCM's [README][readme], **especially the\r\n  [Frequently Asked Questions][faq] section.**\r\n- [x] I have searched YCM's issue tracker to find issues similar to the one I'm\r\n  about to report and couldn't find an answer to my problem. ([Example Google\r\n  search.][search])\r\n- [x] If filing a bug report, I have included the output of `vim --version`.\r\n- [x] If filing a bug report, I have included the output of `:YcmDebugInfo`.\r\n- [x] If filing a bug report, I have included the output of\r\n  `:YcmToggleLogs stderr`.\r\n- [x] If filing a bug report, I have included which OS (including specific OS\r\n  version) I am using.\r\n- [x] If filing a bug report, I have included a minimal test case that reproduces\r\n  my issue.\r\n- [x] **I understand this is an open-source project staffed by volunteers and\r\n  that any help I receive is a selfless, heartfelt _gift_ of their free time. I\r\n  know I am not entitled to anything and will be polite and courteous.**\r\n- [x] **I understand my issue may be closed if it becomes obvious I didn't\r\n  actually perform all of these steps.**\r\n\r\nThank you for adhering to this process! It ensures your issue is resolved\r\nquickly and that neither your nor our time is needlessly wasted.\r\n\r\n# Issue Details\r\n\r\n#### Environment\r\nOS: `OSX El Capitan 10.11.3 (15D21)`\r\n\r\n#### Outputs\r\nRelevant output of `:YcmToggleLogs stderr` (for full output, [see here](https://paste.fedoraproject.org/343462))\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/jdavila/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py\", line 861, in _handle\r\n    return route.call(**args)\r\n  File \"/Users/jdavila/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py\", line 1734, in wrapper\r\n    rv = callback(*a, **ka)\r\n  File \"/Users/jdavila/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py\", line 106, in wrapper\r\n    return callback( *args, **kwargs )\r\n  File \"/Users/jdavila/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py\", line 72, in wrapper\r\n    body = callback( *args, **kwargs )\r\n  File \"/Users/jdavila/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py\", line 129, in GetCompletions\r\n    .ComputeCandidates( request_data ) )\r\n  File \"/Users/jdavila/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/general/general_completer_store.py\", line 89, in ComputeCandidates\r\n    candidates += completer.ComputeCandidates( request_data )\r\n  File \"/Users/jdavila/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py\", line 172, in ComputeCandidates\r\n    request_data[ 'query' ] )\r\n  File \"/Users/jdavila/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py\", line 245, in FilterAndSortCandidates\r\n    return self.FilterAndSortCandidatesInner( candidates, sort_property, query )\r\n  File \"/Users/jdavila/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py\", line 250, in FilterAndSortCandidatesInner\r\n    candidates, sort_property, query )\r\n  File \"/Users/jdavila/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer_utils.py\", line 160, in FilterAndSortCandidatesWrap\r\n    ToCppStringCompatible( query ) )\r\nUnicodeEncodeError: 'ascii' codec can't encode character u'\\u2019' in position 19: ordinal not in range(128)\r\n```\r\n\r\nOutput of `:YcmDebugInfo`\r\n```\r\nPrinting YouCompleteMe debug information...\r\n-- Server has Clang support compiled in: True\r\n-- Clang version: clang version 3.7.0 (tags/RELEASE_\r\n370/final)\r\n-- Server running at: http://127.0.0.1:55064\r\n-- Server process ID: 3550\r\n-- Server logfiles:\r\n--   /var/folders/sx/cvg5mz9s0pxf_b3t48mmm0lh0000gn/\r\nT/ycm_temp/server_55064_stdout.log\r\n--   /var/folders/sx/cvg5mz9s0pxf_b3t48mmm0lh0000gn/\r\nT/ycm_temp/server_55064_stderr.log\r\n```\r\n\r\nOutput of `vim --version`\r\n```\r\nVIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 14 2016 22:55:09)\r\nMacOS X (unix) version\r\nIncluded patches: 1-1525\r\nCompiled by Homebrew\r\nHuge version without GUI.  Features included (+) or not (-):\r\n+acl             +farsi           +mouse_netterm   +tag_binary\r\n+arabic          +file_in_path    +mouse_sgr       +tag_old_static\r\n+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white\r\n-balloon_eval    +float           +mouse_urxvt     -tcl\r\n-browse          +folding         +mouse_xterm     +terminfo\r\n++builtin_terms  -footer          +multi_byte      +termresponse\r\n+byte_offset     +fork()          +multi_lang      +textobjects\r\n+channel         -gettext         -mzscheme        +title\r\n+cindent         -hangul_input    +netbeans_intg   -toolbar\r\n-clientserver    +iconv           +packages        +user_commands\r\n+clipboard       +insert_expand   +path_extra      +vertsplit\r\n+cmdline_compl   +job             +perl            +virtualedit\r\n+cmdline_hist    +jumplist        +persistent_undo +visual\r\n+cmdline_info    +keymap          +postscript      +visualextra\r\n+comments        +langmap         +printer         +viminfo\r\n+conceal         +libcall         +profile         +vreplace\r\n+cryptv          +linebreak       +python          +wildignore\r\n+cscope          +lispindent      -python3         +wildmenu\r\n+cursorbind      +listcmds        +quickfix        +windows\r\n+cursorshape     +localmap        +reltime         +writebackup\r\n+dialog_con      -lua             +rightleft       -X11\r\n+diff            +menu            +ruby            -xfontset\r\n+digraphs        +mksession       +scrollbind      -xim\r\n-dnd             +modify_fname    +signs           -xsmp\r\n-ebcdic          +mouse           +smartindent     -xterm_clipboard\r\n+emacs_tags      -mouseshape      +startuptime     -xterm_save\r\n+eval            +mouse_dec       +statusline      -xpm\r\n+ex_extra        -mouse_gpm       -sun_workshop\r\n+extra_search    -mouse_jsbterm   +syntax\r\n   system vimrc file: \"$VIM/vimrc\"\r\n     user vimrc file: \"$HOME/.vimrc\"\r\n 2nd user vimrc file: \"~/.vim/vimrc\"\r\n      user exrc file: \"$HOME/.exrc\"\r\n  fall-back for $VIM: \"/usr/local/share/vim\"\r\nCompilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -F/usr/local/Frameworks -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1\r\nLinking: /usr/bin/clang   -L. -L/usr/local/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -o vim        -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -F/usr/local/Cellar/python/2.7.11/Frameworks -framework Python   -lruby.2.0.0 -lobjc\r\n```\r\n\r\n#### Reproduce Steps\r\nCreate a YAML file\r\n1. `vim reproduce.yml`\r\n2. Make the content something like\r\n\r\n```yml\r\n---\r\n- somekey: somevalue\r\n```\r\n\r\n3. Write\r\n4. Insert mode and attempt to add `~/$any_char` to the end of `somevalue` (or anywhere else). Where $any_char can by any alphanumeric character. Example `- somekey: somevalue ~/foo`\r\n5. Note that this doesnt happen with text files. So far I've been able to replicate with python and yaml files. Haven't tried others. With python just create an empty python file and try to define a variable with a string value starting with `~/`\r\n\r\n### Error result\r\n\r\n```\r\nUnicodeEncodeError: 'ascii' codec can't encode character u'\\u2019' in position 19: ordinal not in range(128)\r\n```\r\n\r\n[cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md\r\n[code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md\r\n[readme]: https://github.com/Valloric/YouCompleteMe/blob/master/README.md\r\n[faq]: https://github.com/Valloric/YouCompleteMe/blob/master/README.md#faq\r\n[search]: https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fgithub.com%2FValloric%2FYouCompleteMe%2Fissues%20python%20mac\r\n"},"comment":{"url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/comments/204165466","html_url":"https://github.com/Valloric/YouCompleteMe/issues/2069#issuecomment-204165466","issue_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/2069","id":204165466,"user":{"login":"puremourning","id":10584846,"avatar_url":"https://avatars.githubusercontent.com/u/10584846?v=3","gravatar_id":"","url":"https://api.github.com/users/puremourning","html_url":"https://github.com/puremourning","followers_url":"https://api.github.com/users/puremourning/followers","following_url":"https://api.github.com/users/puremourning/following{/other_user}","gists_url":"https://api.github.com/users/puremourning/gists{/gist_id}","starred_url":"https://api.github.com/users/puremourning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puremourning/subscriptions","organizations_url":"https://api.github.com/users/puremourning/orgs","repos_url":"https://api.github.com/users/puremourning/repos","events_url":"https://api.github.com/users/puremourning/events{/privacy}","received_events_url":"https://api.github.com/users/puremourning/received_events","type":"User","site_admin":false},"created_at":"2016-03-31T23:06:17Z","updated_at":"2016-03-31T23:06:17Z","body":"@defionscode  It would be real;ly useful if you could checkout my YouCompleteMe and ycmd branches which I hope resolve this (and a number of other) unicode issues:\r\n\r\n- YouCompleteMe: https://github.com/puremourning/YouCompleteMe/tree/unicode\r\n- ycmd (check out in `YouCompleteMe/third_party/ycmd`: https://github.com/puremourning/ycmd-1/tree/unicode-investigation\r\n\r\nFeedback on whether or not it resolves your particular issue will speed up getting it PR'd :)\r\n\r\nThanks!"}}