moved find-output-encoding to closure-common, thanks to Nathan Bird

This commit is contained in:
David Lichteblau
2008-05-19 23:58:58 +02:00
committed by David Lichteblau
parent fc832df789
commit 294e93c3a8
2 changed files with 22 additions and 0 deletions

View File

@ -25,6 +25,27 @@
(defmacro until (test &body body)
`(do () (,test) ,@body))
(defun find-output-encoding (name)
(when (stringp name)
(setf name (find-symbol (string-upcase name) :keyword)))
(cond
((null name)
(warn "Unknown encoding ~A, falling back to UTF-8" name)
:utf-8)
((find name '(:utf-8 :utf_8 :utf8))
:utf-8)
#-rune-is-character
(t
(warn "Unknown encoding ~A, falling back to UTF-8" name)
:utf-8)
#+rune-is-character
(t
(handler-case
(babel-encodings:get-character-encoding name)
(error ()
(warn "Unknown encoding ~A, falling back to UTF-8" name)
:utf-8)))))
;;; ystream
;;; +- encoding-ystream
;;; | +- octet-vector-ystream