This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A few tips


Hi all,

I have come across a few problems while developing Kawa servlets
generating pages with accentuated characters (diacritics). Let me share
my experience, since most of these things seem undocumented (AFAIK).

I run Kawa servlets with Tomcat 4.1 on Linux, using Sun?s JDK 2
v1.4.1_01. The servlet first loads a number of configuration files and
then answers to HTTP requests. Some of the configuration files contain
Scheme strings with diacritics (French accents, for instance). These
strings are inserted into the XML document generated by the servlet.
There are also some string constants hard-coded in the Scheme source
files. 

Result: all the special characters are improperly rendered by the
servlet. 

Solution: 

1. For the Scheme strings in the configuration files, first set the
global variable ?port-char-encoding? to ?ISO-8859-1?, 

  (set! port "ISO-8859-1")

then open the file as usual.

2. For the constant Scheme strings in the source code, you must make
sure that Kawa reads them properly when compiling. So add the mutation
to 'port-char-encoding' on the command-line:

shell> kawa -e '(set! port-char-encoding "ISO-8859-1")' -C
sourcefile.scm

3. Make sure the strings are not put in 'unescaped-data'. 

This way, all the special characters (those with French diacritics) will
be translated to their equivalent numerical entities (é for é)
properly.

[Note: these problems may be due to a special configuration of the C
locale, but I can't modify it easily for Tomcat. Also, these problems do
not show up under Windows XP.]

Dominique Boucher, Ph.D
NuEcho Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]