Open edpittol opened 11 years ago
My easy solution (Mac OS X 10.9, Sublime 2):
In file: .../Sublime Text 2/Packages/PhpTidy/php_tidy.py
Change Row 73 from: newContent = fileHandle.read() in in newContent = fileHandle.read().decode('utf-8')
Now, PhpTidy works fine (for me). Check the Sublime Console Output for details or errors. Here the solution in german language: http://www.administrator.de/contentid/221695
best regards Admtech
Yup, I just experienced this same error. I'm on Mac OS X 10.9 running Sublime 2.
@admtech Your solution fixed it for me. Thanks!
For those who struggle to find what character cause problem: this quickly created plugin ( http://stackoverflow.com/a/13002055 ) helped me to find position of a problematic character in my code.
thanks @admtech, your solution worked perfectly for me :)
When I run PhpTidy, nothing happens, and I get this error in the console: Traceback (most recent call last): File ".\sublimeplugin.py", line 362, in run File ".\php_tidy.py", line 61, in run UnicodeEncodeError: 'ascii' codec can't encode character u'\xd3' in position 18: ordinal not in range(128) Writing file /C/xampp/htdocs/Oscar/asdfasdf.php with encoding UTF-8
I tried the solution proposed her, but it didn't work. My error is sligthly different from the one posted in here. Could somebody help me with this, please?
I've tried @admtech's solution which didn't work for me (Sublime 3, OSX).
What did work, was changing line 72 (not 73) in .../Sublime Text 3/Packages/PhpTidy/php_tidy.py
from:
fileHandle = open ( tmpfile, 'r' )
to
fileHandle = open ( tmpfile, 'r', encoding='utf-8' )
When I applied the Tidy PHP command in the console appear it:
It's because my code has a 'ã' char.