[armedbear-cvs] r11511 - trunk/abcl/src/org/armedbear/lisp/util

Ville Voutilainen vvoutilainen at common-lisp.net
Tue Dec 30 12:15:05 UTC 2008


Author: vvoutilainen
Date: Tue Dec 30 12:15:04 2008
New Revision: 11511

Log:
Use replacement characters for unmappable and malformed
data. This makes the reader more lenient and allows
cl-bench to compile and run out-of-the-box on current
ubuntu installations, for example. At some point, we
may want to add user-definable strategies for handling
unmappable/malformed data.


Modified:
   trunk/abcl/src/org/armedbear/lisp/util/RandomAccessCharacterFile.java

Modified: trunk/abcl/src/org/armedbear/lisp/util/RandomAccessCharacterFile.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/util/RandomAccessCharacterFile.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/util/RandomAccessCharacterFile.java	Tue Dec 30 12:15:04 2008
@@ -49,6 +49,7 @@
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
+import java.nio.charset.CodingErrorAction;
 
 public class RandomAccessCharacterFile {
 
@@ -276,6 +277,8 @@
 	
 	cset = (encoding == null) ? Charset.defaultCharset() : Charset.forName(encoding);
 	cdec = cset.newDecoder();
+	cdec.onMalformedInput(CodingErrorAction.REPLACE); 
+	cdec.onUnmappableCharacter(CodingErrorAction.REPLACE); 
 	cenc = cset.newEncoder(); 
 		
 	bbuf = ByteBuffer.allocate(BUFSIZ);




More information about the armedbear-cvs mailing list