]> code.delx.au - gnu-emacs-elpa/blob - examples/1-hello-world-utf8.el
more documentation and examples
[gnu-emacs-elpa] / examples / 1-hello-world-utf8.el
1 ;;; hello-world-utf8.el --- utf8 hello world server using Emacs Web Server
2 (ews-start
3 '(((lambda (_) t) .
4 (lambda (request)
5 (with-slots (process headers) request
6 (let ((hellos '("こんにちは"
7 "안녕하세요"
8 "góðan dag"
9 "Grüßgott"
10 "hyvää päivää"
11 "yá'át'ééh"
12 "Γεια σας"
13 "Вiтаю"
14 "გამარჯობა"
15 "नमस्ते"
16 "你好")))
17 (ews-response-header process 200
18 '("Content-type" . "text/plain; charset=utf-8"))
19 (process-send-string process
20 (concat (nth (random (length hellos)) hellos) " world")))))))
21 9001)