How important is it to save your source code in UTF-8 format?
Eclipse on Windows uses CP1252 character encoding by default. The CP1251 format means non UTF-8 characters can be saved and I have seen this happen if you copy and paste from a Word document for a comment.
The reason I ask is because out of habit I set-up Maven encoding to be in UTF-8 format and recently it has caught a few non mappable errors.
(update) Please add any reasons for doing so and why, are there some common gotchas that should be known?
(update) What is your goal? To find the best practice so when ask why should we use UTF-8 I have a good answer, right now I don't.
What is your goal? Balance your needs against the pros and cons of this choice.
UTF-8 Pros
\uHHHH
escapingUTF-8 Cons
\uHHHH
increases risk of character corruption
ASCII Pros
ASCII Cons
Note: ASCII is 7-bit, not "extended" and not to be confused with Windows-1252, ISO 8859-1, or anything else.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments