Package net.sf.basedb.util.charset
Class CharsetUtil
- java.lang.Object
-
- net.sf.basedb.util.charset.CharsetUtil
-
public class CharsetUtil extends Object
Helper class for working with charsets and enabling the UTF-8 with fallback charsets: X-UTF-8_with_ISO-8859-1_fallback X-UTF-8_with_windows-1252_fallback- Since:
- 3.15
- Author:
- nicklas
-
-
Field Summary
Fields Modifier and Type Field Description static CharsetProvider
UTF8_WITH_FALLBACK
The provider that is providing the UTF-8 with fallback characeter sets.
-
Constructor Summary
Constructors Constructor Description CharsetUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Enumeration<String,String>
asEnumeration(Collection<String> charsets)
Convert charset names to an enumeration with display-friendly key/title pairs.static List<String>
getAllCharsets(boolean includeFallbacks)
Get all charsets thatConfig.getAllCharsets()
returns and optionally include the fallback charsets.static Charset
getCharset(String name)
Get a character set by name.
-
-
-
Field Detail
-
UTF8_WITH_FALLBACK
public static final CharsetProvider UTF8_WITH_FALLBACK
The provider that is providing the UTF-8 with fallback characeter sets.
-
-
Method Detail
-
getCharset
public static Charset getCharset(String name)
Get a character set by name. This will first look if it is a UTF-8 with fallback charset and if not check the systemCharset.forName(String)
.
-
getAllCharsets
public static List<String> getAllCharsets(boolean includeFallbacks)
Get all charsets thatConfig.getAllCharsets()
returns and optionally include the fallback charsets. Note that the fallback charsets are automatically sorted just below the UTF-8 character set.
-
asEnumeration
public static Enumeration<String,String> asEnumeration(Collection<String> charsets)
Convert charset names to an enumeration with display-friendly key/title pairs.
-
-