Question

I am starting out on a new project, and I want to know what encoding I should choose for my code files.

I am writing a web app in Python + JavaScript + HTML + CSS on Linux, and my code editors Notepad++ and KomodoEdit give me some options:

  • Encode in ANSI
  • Encode in UTF-8 without BOM
  • Encode in UTF-8

I am not sure which encoding should I choose.

Was it helpful?

Solution

The answer could depend upon the operating system and versions of software (in particular, version of Python) you are using, but I would choose "Encode in UTF-8 without BOM"

In practice I would avoid using non-ASCII characters in source code. If you need them, use them only in string literals and in comments.

Avoid having them in identifiers.

OTHER TIPS

Better use UTF-8 as its a web application, the UTF-8 support almost all the browsers and operating systems.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top