问题
I use Web essentials to compile my typescript files on save (Visual Studio 2012), but i got an empty js and this message :
Compile Error.
See error list for details
error TS5012: Cannot read file 'C:/Users/Nor/Documents/Tribway/tribway-InvitationPage/Tribway/Scripts/Tribway/Invitations.ts': Unsupported file encoding.
回答1:
File encoding was an issue with TS 0.9.0 Fixed in the latest version. You can download 0.9.1 from here : https://typescript.codeplex.com/releases/view/102929
PS: I recommend uninstalling WebEssentials before installing 0.9.1 as they tend to conflict (webessentials starts to leak memory). TS 0.9.1 has pretty awesome and stable support for Visual Studio 2012
回答2:
I had this problem with TypeScript version 0.9.1.1 using Visual Studio 2012. The issue was caused by me inserting a UK pound currency symbol into the file when the file had a 'Western European (Windows) - Codepage 1252' encoding.
The solution was to save the file with a UTF-8 encoding (which I would have expected it to have had in the first place).
To do this in Visual Studio click on File -> Advanced Save Options and choose an encoding of 'Unicode (UTF-8 with signature) - Codepage 65001' and then save your file. The TypeScript compiler is then happy again.
回答3:
I have the same issue with TS 0.9.1, first with WebEssentials installed and then (on a clean installation) with WebEssentials. I found no information for fixing it.
I know this is not a solution, but I returned to TS 8.1.0, with this version I don't have the error "Unsupported file encoding".
I'll try the next version of TS.
回答4:
I had this problem with TypeScript 0.9.5 using VS 2013. The issue was caused by a 'Ç' character within the ts file. Removing this character solved the problem.
来源:https://stackoverflow.com/questions/18205199/typescript-error-web-essential