Hi,
I'm using Cocoon 2 and Postgres 7 on Slackware 8, JDK 1.4.
My database and pages contain French characters (like �,�,�, ...)
I use XSP to get the data from PG.
I can show all the data correctly when I set the encoding to ISO-8859-1.
I wrote some plsql procedures to store data. I call them from my XSP pages.
This is where it goes wrong: the French characters are stored in an unreadable
manner. (Storing is the only thing where it goes wrong)
Calling the function from the command line with the French characters works
fine. It's only when I post the page and call the function that it goes
wrong.
Any ideas ??
Here's some of my code:
1) Sample XSP where it goes wrong
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:xsp-session="http://apache.org/xsp/session/2.0"
create-session="true">
<html>
<head>
<link rel="stylesheet" type="text/css"
href="./../css/pierrefabre.css"/>
</head>
<body>
<div style="position:absolute; left: 5px; top: 5px">
<img src="./../images/product.png"/>
</div>
<div style="position:absolute; left: 60px; top: 5px">
<h1>Nouveau type de cancer</h1>
</div>
<div style="position:relative; top: 40px">
<esql:connection>
<esql:pool>pierrefabre</esql:pool>
<esql:execute-query>
<esql:query>
select fnCancerTypeInsert ('<xsp-request:get-parameter
name="description"/>')
</esql:query>
<esql:results>
<esql:row-results>
<xsp:logic>
if (<esql:get-string
column="fnCancerTypeInsert"/>.equals("1"))
{
<p class="error">Ce type de
cancer existe d�ja. Les modifications ne
sont pas enr�gistr�es.</p>
} ;
if (<esql:get-string
column="fnCancerTypeInsert"/>.equals("0"))
{
<p class="message">Les
modifications sont enr�gistr�es.</p>
};
</xsp:logic>
<input type="submit" value="R�tour"
onclick="window.location = './cancertypes.list.html';" class="button"/>
</esql:row-results>
</esql:results>
</esql:execute-query>
</esql:connection>
</div>
</body>
</html>
</xsp:page>
2) Cocoon.xconf setting for the database
<datasources>
<jdbc name="pierrefabre">
<pool-controller max="10" min="5"/>
<dburl>jdbc:postgresql://10.32.1.3:5432/pierrefabre?charSet=LATIN1</dburl>
<user>postgres</user>
<password/>
</jdbc>
3) The pgplsql function called in that page
create function fnCancerTypeInsert (varchar(50)) returns integer as
'
declare
p_description alias for $1 ;
v_count integer ;
begin
select into v_count count(*) from tblCancerTypes
where upper(description) = upper(p_description) ;
if v_count > 0 then
return 1 ;
end if ;
insert into tblCancerTypes
values (p_description) ;
return 0 ;
end ;
' language 'plpgsql' ;
--
Kind regards,
Yves Vindevogel
Implements
Kortrijkstraat 2 bus 1 -- 9700 Oudenaarde -- Belgium
Phone/Fax: +32 (55) 45.74.73 -- Mobile: +32 (478) 80.82.91
Mail: [EMAIL PROTECTED] -- www.implements.be
Quote: The winner never says participating is more important than winning.
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>