#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.576 2006/03/07 06:40:24 cph Exp $
+$Id: runtime.pkg,v 14.577 2006/03/07 19:56:21 cph Exp $
Copyright 1988,1989,1990,1991,1992,1993 Massachusetts Institute of Technology
Copyright 1994,1995,1996,1997,1998,1999 Massachusetts Institute of Technology
utf32-string-length
utf32-string-valid?
utf32-string?
+ utf8-string->string
utf8-string->wide-string
utf8-string-length
utf8-string-valid?
#| -*-Scheme-*-
-$Id: unicode.scm,v 1.25 2005/12/13 15:29:52 cph Exp $
+$Id: unicode.scm,v 1.26 2006/03/07 19:56:25 cph Exp $
Copyright 2001,2003,2004,2005 Massachusetts Institute of Technology
(fix:or #x80 (fix:and (vector-8b-ref string i) #x3F)))
(loop (fix:+ i 1) (fix:+ i* 2))))))
string*)))
+
+(define (utf8-string->string string #!optional start end)
+ (let ((input (open-input-string string start end)))
+ (port/set-coding input 'UTF-8)
+ (call-with-output-string
+ (lambda (output)
+ (let loop ()
+ (let ((c (read-char input)))
+ (if (not (eof-object? c))
+ (begin
+ (write-char c output)
+ (loop)))))))))
\f
(define (validate-utf8-char string start end)