Re: Question on UTF-8 output over CGI
Jean Louis <[email protected]> Fri, 28 Sep 2018 08:08:34 +0200
| Newsgroups | gmane.lisp.clisp.general |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Sep 28, 2018 at 06:54:15AM +0200, Gunter Königsmann wrote:
> What is transferred over CGI in the erroneous
> case. And just to make sure that the problem
> lies in CLISP: Is it possible that clisp
> actually outputs UTF8 and one of the other tools
> involved is convinced not to get Unicode and
> converts the characters somehow?
And I cannot compile it so that UTF-8 output takes
place.
So I do following:
clisp -norc -E utf-8 -i encoding.cgi
and:
(saveinitmem "encoding2.cgi" :executable t :quiet t :init-function 'main :keep-global-handlers t :norc t)
;; Wrote the memory image into encoding2.cgi (13,663,752 bytes)
Bytes permanently allocated: 198,888
Bytes currently in use: 3,664,768
Bytes available until next GC: 69,872
3664768 ;
69872 ;
198888 ;
2 ;
71264 ;
10000
while encoding.cgi is this one:
;; #!/usr/bin/clisp -E utf-8
(setf custom:*default-file-encoding* "utf-8")
(setf custom:*misc-encoding* "utf-8")
(setf custom:*terminal-encoding* "utf-8")
(setf custom:*pathname-encoding* "utf-8")
(setf custom:*foreign-encoding* "utf-8")
(defun headers ()
(format t "Content-type: text/plain; charset=\"UTF-8\"~2%"))
(defun main ()
(headers)
(format t "~A č" (getenv "LANG"))
(exit))
and the result that I get on web is following:
NIL
*** - WRITE-STRING: Character #\u010D cannot be represented in
the character set CHARSET:ASCII
The following restarts are available:
ABORT :R1 ABORT
but if I just use:
#!/usr/bin/clisp -E utf-8
;; (setf custom:*default-file-encoding* "utf-8")
;; (setf custom:*misc-encoding* "utf-8")
;; (setf custom:*terminal-encoding* "utf-8")
;; (setf custom:*pathname-encoding* "utf-8")
;; (setf custom:*foreign-encoding* "utf-8")
(defun headers ()
(format t "Content-type: text/plain; charset=\"UTF-8\"~2%"))
(defun main ()
(headers)
(format t "~A č" (getenv "LANG"))
(exit))
(main)
than it works. However, I rather need it compiled.
--
Jean Louis
_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list