1

Is it ok to use a localized encoding (i.e. ISO-8859-15) instead of ANSI/UTF-8/some standard for code?

What when you have names that do not translate very well into english code? Or when your company and your customers are (and always will be) local and not international, like governments? And what about using special characters like people in almost all countries have?

What do you think, what encodings do you use?

3
  • 1
    ANSI is localized too
    – Javier
    Apr 13, 2011 at 15:56
  • 5
    With UTF-8 you are local in any language.
    – Ingo
    Apr 13, 2011 at 16:02
  • 1
    How are you sure your business and customers will always be local? I've seen businesses grow more than initially expected before. Apr 13, 2011 at 17:01

3 Answers 3

17

No. Use UTF-8. There's no reason to use anything but unicode-based encodings in this century.

3

What when you have names that do not translate very well into english code? Or when your company and your customers are (and always will be) local and not international, like governments? And what about using special characters like people in almost all countries have?

All of those characters are available in UTF-8. The only drawback is that UTF-8 uses 2 or 3 bytes for characters that ISO-8859-n represents in 1 byte, but this is a very minor problem for code because most code uses ASCII-only identifiers, even in languages where Unicode ones are allowed.

If you use a single-byte encoding like ISO-8859-n, you restrict your character repertoire to 256 characters. And what if you need characters (like “—”) that are not in ISO-8859-15?

What if one of your tools misidentifies your files as being encoded in ISO-8859-1, and you lose your €'s?

What if your locale-specific encoding is one of the rarer ones like VISCII that isn't supported by all charset libraries?

1

For UNIX and DOS scripts, use the same ecoding that is installed in your terminal (so that you can view the code using UNIX/DOS command-line utilities).

Use UTF-8 elsewhere, unless you are using command-line 'svn diff' on your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.