Strict wrapper for encodings
parent
4cfd62c373
commit
86efc8467c
|
@ -0,0 +1 @@
|
|||
Daniel Ehrenberg
|
|
@ -0,0 +1,6 @@
|
|||
USING: io.encodings.strict io.encodings.ascii tools.test
|
||||
arrays io.encodings.string ;
|
||||
IN: io.encodings.strict.test
|
||||
|
||||
[ { HEX: fffd } ] [ { 128 } ascii decode >array ] unit-test
|
||||
[ { 128 } ascii strict decode ] must-fail
|
|
@ -0,0 +1,18 @@
|
|||
! Copyright (C) 2008 Daniel Ehrenberg
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: io.encodings kernel accessors inspector ;
|
||||
IN: io.encodings.strict
|
||||
|
||||
TUPLE: strict code ;
|
||||
C: strict strict
|
||||
|
||||
TUPLE: decode-error ;
|
||||
: decode-error ( -- * ) \ decode-error construct-empty throw ;
|
||||
M: decode-error summary
|
||||
drop "Error in decoding input stream" ;
|
||||
|
||||
M: strict <decoder>
|
||||
code>> <decoder> [ strict ] change-code ;
|
||||
|
||||
M: strict decode-char
|
||||
code>> decode-char dup replacement-char = [ decode-error ] when ;
|
|
@ -0,0 +1 @@
|
|||
Strict wrapper for encodings
|
|
@ -0,0 +1 @@
|
|||
text
|
Loading…
Reference in New Issue