Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
1  
ANSI is localized too –  Javier Apr 13 '11 at 15:56
5  
With UTF-8 you are local in any language. –  Ingo Apr 13 '11 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. –  David Thornley Apr 13 '11 at 17:01

3 Answers 3

up vote 16 down vote accepted

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

share|improve this answer

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?

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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