A
A
Adamos2022-04-04 11:05:31
typescript
Adamos, 2022-04-04 11:05:31

Typescript and cp1251?

I am writing a TypeScript section on the site, which is still on cp1251, and there is so much legacy that it is not yet an option to translate it to UTF-8.
TypeScript compiles successfully no matter what encoding its files are in. But the resulting Javascript is strictly in UTF-8, and on the page all its Cyrillic turns into krakozyabry.
Specifying charset in tsconfig.json is useless - as I understand it, this is a source encoding setting, and the compiler understands it without any hints.
Crutches like manual conversion or removal of text constants into a separate file, I imagine, but both are inconvenient.
Are there any settings that allow you to recode the compiled Javascript into the correct encoding automatically?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2022-04-04
@Adamos

add iconv to the pipeline everything will be automatic
here is the package for you
https://www.npmjs.com/package/iconv-lite

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question