Subject: [clisp-list] Content-Type: text/html; Charset=?? HTTP header

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Fri May 17 04:57:04 2002

Hi,

how could a HTTP-server writer possibly determine a correct value for the Charset option to the Content-Type HTTP header?
This is important for a CLISP built with Unicode.

E.g. the CLISP inspector currently has no means to provide any charset indication (think about asian or eastern european users).

One solution path IMHO, is that an EXT:ENCODING object doesn't have provide an API function that tells the name, although it's available internally. That could be a good start.

Are these names valid names to the HTTP/MIME Charset attribute?

I suggest:
(EXT:ENCODING-NAME enc) -> name (as symbol or as string)
; internal encodings: a symbol CHARSET:xyz
; GNU iconv encodings (where available): a string, as supplied to (ext:make-encoding) to create this iconv encoding.

Then, *possibly*, the header coule become
#+(and CLISP UNICODE)
(format socket "Content-Type: text/html; Charset=~A~%"
  (ext:encoding-name (stream-external-format socket)))

I'd appreciate comments on this issue, and on the solution.
Maybe some nickname mapping could be added, e.g. CP1252 -> WINDOWS-1252, because that's what MS-junk seems to output??

For interim experiments with my proposal, you can use:
(defun ext::encoding-name (encoding)
  (check-type encoding ext:encoding)
  (sys::%record-ref encoding 3))
until this gets coded as a C LISPFUN into CLISP -- if it makes sense.

Regards,
	Jörg Höhle.