Closed diepdtnse03145 closed 8 years ago
Try running this before starting the server:
(setf sb-impl::*default-external-format* :utf-8)
I ran
CL-USER> (setf sb-impl::*default-external-format* :utf-8)
:UTF-8
CL-USER> (defun app (env)
`(200
(:content-type "text/html" :charset "utf-8")
("<html><head></head><body>á hự</body></html>")))
(clack:clackup #'app)
; in: DEFUN APP
; (SB-INT:NAMED-LAMBDA APP
; (ENV)
; (BLOCK APP
; `(200 (:CONTENT-TYPE "text/html" :CHARSET "utf-8")
; ("<html><head></head><body>á hự</body></html>"))))
;
; caught STYLE-WARNING:
; The variable ENV is defined but never used.
;
; compilation unit finished
; caught 1 STYLE-WARNING condition
Hunchentoot server is started.
Listening on localhost:5000.
#S(CLACK.HANDLER::HANDLER
:SERVER :HUNCHENTOOT
:ACCEPTOR #<SB-THREAD:THREAD "clack-handler-hunchentoot" RUNNING
{100696AA93}>)
CL-USER>
still don't work. The result is still á hự
.
I'm new to Common Lisp, did I miss something herer?
Try this:
(defun app (env)
`(200
(:content-type "text/html" :charset "utf-8")
("<!DOCTYPE html>
<html><head><meta charset='UTF-8'></head><body>á hự</body></html>")))
It worked for me.
It work now. Thank you very much!
Hello, I'm new to Common Lisp, and your library work great :) One small problem: I tried to make a website in my mother language, but the UTF-8 character won't displayed correctly. Here is the code:
Result
á hự
, source:in Firefox 48.0 Ubuntu 16.04 64 bit. I thought string literal in Common Lisp may need escape for utf-8 character such as
"\u0061"
but(format t "á hự")
work fine. I'm using SBCL 1.3.1.debian.What did I do wrong? Should I html escape all non ANSI character in my web page?