Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeScript error Web essential

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.
like image 572
NOr Avatar asked Aug 13 '13 09:08

NOr


3 Answers

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.

like image 113
vextasy Avatar answered Nov 18 '22 04:11

vextasy


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

like image 32
basarat Avatar answered Nov 18 '22 02:11

basarat


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.

like image 1
Paul3k Avatar answered Nov 18 '22 02:11

Paul3k