You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/01/19 16:02:42 UTC
svn commit: r1233413 -
/tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java
Author: markt
Date: Thu Jan 19 15:02:42 2012
New Revision: 1233413
URL: http://svn.apache.org/viewvc?rev=1233413&view=rev
Log:
Provide easy access to the two most frequently used Charsets
Modified:
tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java?rev=1233413&r1=1233412&r2=1233413&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java Thu Jan 19 15:02:42 2012
@@ -50,6 +50,9 @@ public class B2CConverter {
private static final Map<String, Charset> encodingToCharsetCache =
new HashMap<String, Charset>();
+ public static final Charset ISO_8859_1;
+ public static final Charset UTF_8;
+
static {
for (Charset charset: Charset.availableCharsets().values()) {
encodingToCharsetCache.put(
@@ -59,6 +62,17 @@ public class B2CConverter {
alias.toLowerCase(Locale.US), charset);
}
}
+ Charset iso88591 = null;
+ Charset utf8 = null;
+ try {
+ iso88591 = getCharset("ISO-8859-1");
+ utf8 = getCharset("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // Impossible. All JVMs must support these.
+ e.printStackTrace();
+ }
+ ISO_8859_1 = iso88591;
+ UTF_8 = utf8;
}
public static Charset getCharset(String enc)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org