Re: Problem with Character Encoding in Cocoon 2 / Postgres

2002-12-12 Thread Steven Noels
Yves Vindevogel wrote:


Hi All,

My problem is solved thanks to your help (all of you)
Therefore, I'd like to post what I did because I had some mails from people 
from Italy and Zwitserland with the same problem.  This is kind of my help 
towards them.

Good thinking!

Now please go and add it to 
http://outerthought.net/wiki/Wiki.jsp?page=HowTos or 
http://outerthought.net/wiki/Wiki.jsp?page=FAQs ;-)

Cheers,

/Steven
--
Steven Noelshttp://outerthought.org/
Outerthought - Open Source, Java  XML Competence Support Center
Read my weblog at  http://radio.weblogs.com/0103539/
stevenn at outerthought.orgstevenn at apache.org


-
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]



Problem with Character Encoding in Cocoon 2 / Postgres

2002-12-11 Thread Yves Vindevogel
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
h1Nouveau type de cancer/h1
/div


div style=position:relative; top: 40px


esql:connection
esql:poolpierrefabre/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=errorCe 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=messageLes 
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/
  
dburljdbc:postgresql://10.32.1.3:5432/pierrefabre?charSet=LATIN1/dburl
  userpostgres/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]




Re: Problem with Character Encoding in Cocoon 2 / Postgres

2002-12-11 Thread Matthias Brunner
On Wednesday 11 December 2002 10:32, Yves Vindevogel wrote:
 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.

 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.


Is multibyte encoding enabled in the database (e.g. createdb -E 
ISO-8859-1 mydb)?

Best regards!
-- 
Matthias Brunner [EMAIL PROTECTED]
PGP FP 7862 32B3 3B75 292A F76F  5042 8587 21AB 5B89 D501
Check out http://blumenstrasse.vol.at/~mb/gpgkey.asc


-
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]




Re: Problem with Character Encoding in Cocoon 2 / Postgres

2002-12-11 Thread Yves Vindevogel

I didn't have this ...

I recreated the database with this encoding in it 
but it still doesn't work


 On Wednesday 11 December 2002 10:32, Yves Vindevogel wrote:
  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.
 
  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.

 Is multibyte encoding enabled in the database (e.g. createdb -E
 ISO-8859-1 mydb)?

 Best regards!

-- 
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]




Re: Problem with Character Encoding in Cocoon 2 / Postgres

2002-12-11 Thread Jean-Roch SCHMITT
Hi/Bonjour,

As far as I understand, I have encountered the same problem.
I have found the following link useful :
http://marc.theaimsgroup.com/?l=xml-cocoon-usersm=103701015026425w=2

Indeed I have solved the problem this way.


I hope this helps.

rgds



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 ??



-
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]




Re: Problem with Character Encoding in Cocoon 2 / Postgres

2002-12-11 Thread Yves Vindevogel
Hi All,

My problem is solved thanks to your help (all of you)
Therefore, I'd like to post what I did because I had some mails from people 
from Italy and Zwitserland with the same problem.  This is kind of my help 
towards them.

I changed my sitemap:
map:serializer logger=sitemap.serializer.xml 
mime-type=text/xml 
name=xml src=org.apache.cocoon.serialization.XMLSerializer
encodingISO-8859-1/encoding
/map:serializer
map:serializer logger=sitemap.serializer.html 
mime-type=text/html 
name=html pool-grow=4 pool-max=32 pool-min=4 
src=org.apache.cocoon.serialization.HTMLSerializer
buffer-size1024/buffer-size
encodingISO-8859-1/encoding
/map:serializer


I added an action:
map:actions
map:action name=set-encoding 
src=org.apache.cocoon.acting.SetCharacterEncodingAction/
/map:actions


I added a meta tag into my pages
meta http-equiv=Content-Type content=text/html; 
charset=ISO-8859-1/

I changed the jdbc url into  jdbc:postgresql://server/db?charSet=ISO-8859-1


After this, all went well, but I wanted to be sure what the real problem was.
So, I removed all of them again and started to add one by one.

In the end, the most simple one did it:
The serializer :
map:serializer logger=sitemap.serializer.html 
mime-type=text/html 
name=html pool-grow=4 pool-max=32 pool-min=4 
src=org.apache.cocoon.serialization.HTMLSerializer
buffer-size1024/buffer-size
encodingISO-8859-1/encoding
/map:serializer

Jean-Roch Smitt gave me this useful link that helped me most ...
http://marc.theaimsgroup.com/?l=xml-cocoon-usersm=103701015026425w=2


Thanks again to all !!
-- 
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]