[kaffe] CVS kaffe (kaz): libraries/javalib/kaffe/io/ByteToCharConverter.java
Kaffe CVS
cvs-commits at kaffe.org
Mon Dec 29 18:25:02 PST 2003
PatchSet 4244
Date: 2003/12/30 02:22:30
Author: kaz
Branch: HEAD
Tag: (none)
Log:
2003-12-30 Ito Kazumitsu <kaz at maczuka.gcd.org>
* libraries/javalib/kaffe/io/ByteToCharConverter.java
(getConverterInternal),
libraries/javalib/kaffe/io/CharToByteConverter.java
(getConverterInternal):
For an encoding name that cannot be a class name, directly
return an instance of the iconv based converter.
Members:
ChangeLog:1.1833->1.1834
libraries/javalib/kaffe/io/ByteToCharConverter.java:1.18->1.19
libraries/javalib/kaffe/io/CharToByteConverter.java:1.12->1.13
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1833 kaffe/ChangeLog:1.1834
--- kaffe/ChangeLog:1.1833 Mon Dec 29 23:59:00 2003
+++ kaffe/ChangeLog Tue Dec 30 02:22:30 2003
@@ -1,3 +1,12 @@
+2003-12-30 Ito Kazumitsu <kaz at maczuka.gcd.org>
+
+ * libraries/javalib/kaffe/io/ByteToCharConverter.java
+ (getConverterInternal),
+ libraries/javalib/kaffe/io/CharToByteConverter.java
+ (getConverterInternal):
+ For an encoding name that cannot be a class name, directly
+ return an instance of the iconv based converter.
+
2003-12-29 Ito Kazumitsu <kaz at maczuka.gcd.org>
* libraries/javalib/kaffe/io/ConverterAlias.java:
Index: kaffe/libraries/javalib/kaffe/io/ByteToCharConverter.java
diff -u kaffe/libraries/javalib/kaffe/io/ByteToCharConverter.java:1.18 kaffe/libraries/javalib/kaffe/io/ByteToCharConverter.java:1.19
--- kaffe/libraries/javalib/kaffe/io/ByteToCharConverter.java:1.18 Wed Nov 6 04:38:41 2002
+++ kaffe/libraries/javalib/kaffe/io/ByteToCharConverter.java Tue Dec 30 02:22:31 2003
@@ -109,7 +109,24 @@
}
try {
if (cls == null) {
- String realenc = encodingRoot + ".ByteToChar" + ConverterAlias.alias(enc);
+ String realenc = ConverterAlias.alias(enc);
+ // Check whether realenc has a character that
+ // cannot be used for class names but may appear
+ // in encoding names. As far as I know, such
+ // characters include: '-'.
+ for (int i = 0; i < realenc.length(); i++) {
+ if (realenc.charAt(i) == '-') {
+ try {
+ return (new ByteToCharIconv (realenc);
+ }
+ catch (UnsupportedEncodingException _) {
+ cache.put(enc, noConverter);
+ return (null);
+ }
+ }
+ }
+ realenc = encodingRoot + ".CharToByte" + realenc;
+ String realenc = encodingRoot + ".ByteToChar" + realenc;
cls = Class.forName(realenc);
cache.put(enc, cls);
}
Index: kaffe/libraries/javalib/kaffe/io/CharToByteConverter.java
diff -u kaffe/libraries/javalib/kaffe/io/CharToByteConverter.java:1.12 kaffe/libraries/javalib/kaffe/io/CharToByteConverter.java:1.13
--- kaffe/libraries/javalib/kaffe/io/CharToByteConverter.java:1.12 Thu Nov 22 06:21:20 2001
+++ kaffe/libraries/javalib/kaffe/io/CharToByteConverter.java Tue Dec 30 02:22:31 2003
@@ -87,7 +87,23 @@
}
try {
if (cls == null) {
- String realenc = encodingRoot + ".CharToByte" + ConverterAlias.alias(enc);
+ String realenc = ConverterAlias.alias(enc);
+ // Check whether realenc has a character that
+ // cannot be used for class names but may appear
+ // in encoding names. As far as I know, such
+ // characters include: '-'.
+ for (int i = 0; i < realenc.length(); i++) {
+ if (realenc.charAt(i) == '-') {
+ try {
+ return (new CharToByteIconv (realenc);
+ }
+ catch (UnsupportedEncodingException _) {
+ cache.put(enc, noConverter);
+ return (null);
+ }
+ }
+ }
+ realenc = encodingRoot + ".CharToByte" + realenc;
cls = Class.forName(realenc);
cache.put(enc, cls);
}
More information about the kaffe
mailing list