Java: Type safe character set
If you are working on strings and want to make sure that they conform to a certain character set and are encoded with a certain encoding scheme you will come across the standard Java class Charset that outlines various character sets that should be available in every implementation of the JVM. Instead of scattering magic strings like “UTF-8” all over your code and catching UnsupportedEncodingException I came up with an enum that encapsulates all this.