From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: slime and lisp buffer encoding Date: Fri, 07 Aug 2009 15:10:12 +0200 Organization: Anevia SAS Message-ID: <7cprb7rcqz.fsf@pbourguignon.anevia.com> References: <2b178719-3db9-4bde-98b0-3ce087614ca6@v23g2000pro.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1249652457 7406 80.91.229.12 (7 Aug 2009 13:40:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Aug 2009 13:40:57 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 07 15:40:50 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MZPgf-00024H-Pj for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Aug 2009 15:40:50 +0200 Original-Received: from localhost ([127.0.0.1]:35878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZPgf-0006Ts-45 for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Aug 2009 09:40:49 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!eweka.nl!hq-usenetpeers.eweka.nl!proxad.net!cleanfeed1-a.proxad.net!nnrp19-2.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:6DgVPGWyDv9CRRo+PEGr8y7j/H4= Original-Lines: 64 Original-NNTP-Posting-Date: 07 Aug 2009 15:10:12 MEST Original-NNTP-Posting-Host: 88.170.236.224 Original-X-Trace: 1249650612 news-2.free.fr 22602 88.170.236.224:52869 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:171754 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:66933 Archived-At: Eric writes: > On Aug 7, 5:52 pm, Eric Abrahamsen wrote: >> Hi, >> >> I'm using Emacs and slime to do a bit of hunchentoot (lisp web server)   >> development, and I'm running into an encoding problem. I don't know   >> which of the links in the chain is causing the problem, so I hope   >> someone here will see what's going... >> >> Basically, using hunchentoot (with cl-who for html templating)   >> involves writing the html templates directly into the source code, and   >> I'm discovering that I can't type utf-8 text into these source files.   >> Compiling a defun with unicode in it results in an encoding error (I   >> believe thrown by slime as the defun gets sent to the repl). >> >> I have set everything I can set (file, keyboard, subprocess IO) to   >> utf-8-unix. The weird thing is, I can type a Latin accented a (à) into   >> the source without trouble. Hunchentoot seems to use a CONTENT-TYPE of   >> iso-8859-1 by default, in which case the à shows up fine in the   >> browser. If I set content type to utf-8, my browser garbles the à. So   >> my lisp strings must be encoded as iso-8859-1, but how did they get   >> that way? And how do I make them utf-8? > > I'll answer my own question: They got that way because iso-8859-1 is > the default string encoding for OpenMCL. Altering inferior-lisp- > program to add the option "-K utf-8" after the executable results in a > lisp that runs in utf-8 by default. Apologies for the noise. Moreover, you have to set things up in hunchetoot to send utf-8 data. Some browser may accept a page declared as iso-8859-1 that actually contain utf-8 data because it's an error often made, but you will want to send headers and meta tags matching your data. * I put on the first line of all my lisp sources: ;;;; -*- mode:lisp;coding:utf-8 -*- (you may configure emacs to do that my default, but I like it that the encoding be "documented" this way in the files). * I confnigure hunchentoot to use utf-8 by default: (defparameter *utf-8* (flex:make-external-format :utf-8 :eol-style :lf) "The UTF-8 encoding.") (setf hunchentoot:*HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT* *utf-8* hunchentoot:*DEFAULT-CONTENT-TYPE* "text/html; charset=UTF-8") * In addition in all the pages I build, I put in the section a