Typescript: Special characters in 'enum' type will be compiled to unicode by default

Created on 25 Jul 2018  路  2Comments  路  Source: microsoft/TypeScript


TypeScript Version: 2.9.1


Search Terms: typescript unicode, typescript enum unicode

Code


export const TestObject = {
  WELCOME: '浣犲ソ',
  TEST: '褌械褋褌',
}

export enum TestEnum {
  WELCOME = '浣犲ソ',
  TEST = '褌械褋褌',
}

Expected behavior:
Fields in TestObject and TestEnum ought to be compiled to a consistent encoding format (utf8).

Actual behavior:
Special characters in Object were compiled to utf8 while those in Enum were compiled to unicode.

Playground Link:
Official Playground

Related Issues:
https://github.com/Microsoft/TypeScript/issues/10498

Bug

Most helpful comment

In JSX same problem
image

I think Typescript should have cli parameter to keep non Latin characters as is (and may be TRUE by default)

All 2 comments

In JSX same problem
image

I think Typescript should have cli parameter to keep non Latin characters as is (and may be TRUE by default)

Any progress?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonathandturner picture jonathandturner  路  147Comments

sandersn picture sandersn  路  265Comments

nitzantomer picture nitzantomer  路  135Comments

yortus picture yortus  路  157Comments

fdecampredon picture fdecampredon  路  358Comments