Search code examples
typescripttypescript1.8

Transpiled JavaScript output contains invalid characters in literals


I have a field definition in TypeScript that looks like that:

languages: Array<{}> = [{ key: "fr", name: "français" }];

When the TypeScript file gets compiled the output in the JavaScript looks like:

this.languages = [{ key: "fr", name: "fran�ais" }];

Why does the transpiler change the literals and how can I prevent that?


Solution

  • Ah, got it by myself...

    The TypeScript file was saved using the default Western European (Windows) - Codepage 1252 encoding; I changed that to Unicode (UTF-8 with signature) - Codepage 65001) which fixed the problem.