From d18d515b29d108e98e6e4e8e22a2487f11ce4493 Mon Sep 17 00:00:00 2001 From: Evan Sebastian Date: Mon, 7 Jul 2014 22:52:17 +0700 Subject: [PATCH] Fix unicode-character filename bug. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issued here https://github.com/Valloric/YouCompleteMe/issues/1069 To reproduce: 1. Create any file with unicode character on its filename, e.g `Ω.c` 2. Open the file and start adding codes until >5 lines (i.e ycm start compiling) 3. YCM will crash due to unicode encoding error. See issue referenced above for complete log. --- python/ycm/vimsupport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ycm/vimsupport.py b/python/ycm/vimsupport.py index 2c39470d..8fd4a01a 100644 --- a/python/ycm/vimsupport.py +++ b/python/ycm/vimsupport.py @@ -103,7 +103,7 @@ def GetUnsavedAndCurrentBufferData(): def GetBufferNumberForFilename( filename, open_file_if_needed = True ): - return GetIntValue( "bufnr('{0}', {1})".format( + return GetIntValue( u"bufnr('{0}', {1})".format( os.path.realpath( filename ), int( open_file_if_needed ) ) )