[hunchentoot-devel] Encoding question

Viljo Marrandi viltsik at gmail.com
Mon Jan 22 10:20:35 UTC 2007


Hello,

Some time ago I started to create one web-page with hunchentoot to
learn lisp with something practical. So far, so good, my site is
almost ready to launch, but I've run into problem I can't find a way
to solve.

My site will be in 3 languages - english, russian and estonian. I use
postgresql as database backend and clsql to do sql stuff. At first I
used latin-1 (I guess it was default) for website and on admin side
too. Everything worked like a charm, I could enter russian text and it
ended up nicely in database, uploading images worked too.

Problem came up when I needed to display localized dates. I use
cl-l10n to do localization. Localized time is made like this:

(format nil "~v,v/cl-l10n:format-time/" "ru_RU" "%e. %B %Y"
(get-universal-time)))

This gave error:

Error while processing connection: #\CYRILLIC_CAPITAL_LETTER_YA is not
a LATIN-1 character.

So I tried to switch everything to UTF-8 (which would be preferred anyway).
(setq hunchentoot:*hunchentoot-default-external-format* :utf-8)

Localized dates and text from database now displayed correctly, but
then I couldn't upload binary files from forms, I guess utf-8 and
binary don't mix well.

I looked at test.lisp (utf) examples, but seems that my lisp knowledge
isn't up to it yet.

Could anyone help me to find solution for this. Either how to get
cl-l10n to output correct latin1 localized dates or how to make
everything in utf-8 and get form uploads to work.

Thanks in advance,
Viljo



More information about the Tbnl-devel mailing list