Eduardo Costa
1/26/2016 8:29:00 PM
On Tuesday, January 26, 2016 at 2:15:58 PM UTC-2, excele...@gmail.com wrote:
> On Tuesday, January 26, 2016 at 8:11:35 AM UTC-8, Eduardo Costa wrote:
> > I am trying to write programs using sbcl, but it seems that the compiler does not work properly when I use non ascii chars. I wrote a very simple program that just write the French expression "Voilá" on the screen. Here is the program:
> >
> > ------- File: calltest.k -------------
> > #!/bin/bash
> >
> > # LANG=pt_PT.UTF-8
> > LC_ALL=en_US.UTF-8
> > LANG=pt_PT.UTF-8 /home/enemm845/bin/sbcl.iii --load> > /home/enemm845/public_html/lsp/test.lsp
> >
> >
> > ---------- File: test.lsp --------
> > ;;#!/home/enemm845/bin/sbcl.iii --script
> >
> > ;;(setf sb-impl::*default-external-format* :utf-8)
> >
> > (format t "Content-Type: text/html~%~%")
> >
> > (format t "
> > <html>
> > <title>Voila</title>
> > <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>
> > <body>
> > <p>Volá</p>
> > </body>
> > </html>
> > " )
> >
> > (exit)
> >
> > In file calltest.k, I tried about every combination of external format. LC_CTYPE, LC_ALL, etc. In the Lisp side, I tried both with *default-external-format* and without it.
> >
> > I noticed that a lot of people are experiencing similar problems with sbcl. Therefore, I hope somebody has found a solution. For languages like French, I can write a program that replaces accented words with html code. For languages like Greek or Chinese, this kind of solution is not available.
>
> I'm a lisp n00b, but when I had to convert an HTML file with non ascii characters, UTF-8 and UTF-8B didn't work, but iso-8859-1 did. So I would recommend trying iso-8859-1 until someone comes by with a better answer.
I tried iso as well, with similar results. Could you check what I did wrong?
;;#!/home/enemm845/bin/sbcl.iii --script
(setf sb-impl::*default-external-format* :iso-8859-1)
(format t "Content-Type: text/html~%~%")
(format t "
<html>
<title>Voila</title>
<meta http-equiv=\"Content-Type\" content=\"text/html;charset=iso-8859-1\"/>
<body>
<p>Volá</p>
</body>
</html>
" )
(exit)
#!/bin/bash
# LANG=pt_PT.UTF-8
LC_ALL=pt_PT.iso-8859-1
export LC_ALL
/home/enemm845/bin/sbcl.iii --load /home/enemm845/public_html/lsp/test.lsp