6

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.
NOr
  • 1,043
  • 2
  • 11
  • 13

4 Answers4

22

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.

vextasy
  • 865
  • 7
  • 12
  • 1
    In Visual Studio 2013 you can achieve the same by doing File > Save ... as > Click arrow pointing down on the save button in the dialog > Save with encoding > Say yes to overwrite the file > Choose the encoding – MartinF Apr 21 '14 at 08:04
  • this popped up for me for the first time ever in VS2015 CTP 6 (released today) - changing to UTF-8 fixed it – Simon_Weaver Feb 24 '15 at 04:32
2

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

basarat
  • 261,912
  • 58
  • 460
  • 511
1

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.

Paul3k
  • 166
  • 1
  • 4
0

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.

Memet Olsen
  • 4,578
  • 5
  • 40
  • 50