You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When having an accented character in the path of the PHP file which needs checked with PHPCS, PHPCS gives the following error:
Exception in thread Thread-X:
Traceback (most recent call last):
File ".\threading.py", line 532, in __bootstrap_inner
File ".\threading.py", line 484, in run
File ".\phpcs.py", line 396, in run
File ".\phpcs.py", line 128, in get_errors
File ".\phpcs.py", line 344, in execute
File ".\phpcs.py", line 347, in parse_report
File ".\phpcs.py", line 149, in shell_out
File ".\subprocess.py", line 633, in __init__
File ".\subprocess.py", line 842, in _execute_child
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 43: ordinal not in range(128)
In this case, it's the 'é' in my name in the path where the to-be-checked file resides in.
I managed to fix it like this:
--- phpcs.original.py Mon Nov 4 11:31:47 2013+++ phpcs.py Mon Nov 4 11:22:20 2013@@ -1,3 +1,4 @@+import sys
import datetime
import os
import re
@@ -145,6 +146,9 @@
"""
home = expanduser("~")
debug_message("cwd: " + home)
++ for index, arg in enumerate(cmd[:]):+ cmd[index] = arg.encode(sys.getfilesystemencoding())
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, startupinfo=info, cwd=home)
It works for me (Windows 7), but I can't test it on other OSes.
The text was updated successfully, but these errors were encountered:
Can you provide an example filename please, as it is working on Mac OS X, so potentially just a windows issue. Also, do you want to raise a PR so your name is in the commit log?
Had to modify the solution ever so slightly, and it is only apparent in ST2, so I wanted to make the fix specific to that, so I know what code I can rip out when I drop support for ST2.
When having an accented character in the path of the PHP file which needs checked with PHPCS, PHPCS gives the following error:
In this case, it's the 'é' in my name in the path where the to-be-checked file resides in.
I managed to fix it like this:
It works for me (Windows 7), but I can't test it on other OSes.
The text was updated successfully, but these errors were encountered: