[xwiki-users] rendering pages with Groovy code
Hi all, We are facing a weird issue. The following code (provided the right host name, username and password)... áéíóú <% import groovy.sql.Sql db = Sql.newInstance("jdbc:mysql://hostname/database", "username", "password", "com.mysql.jdbc.Driver") List samplesIA = db.rows('SELECT * FROM saltmines s where es like "I" and ess like "A" and ids>=1') %> Tomáronse un total de <% println "${samplesIA.size()}"%> mostras da secuencia sedimentaria do perfil P3-6-IA. Edited by any user but admin with programming rights is rendered as... http://mire.environmentalchange.net/~webmaster/images/RightCharaters.png Edited by admin it is rendered this other way... http://mire.environmentalchange.net/~webmaster/images/WrongCharacters.png Please, not the question marks and the absence of the number 32. This happens with any page containing Groovy code in this server, but I am not able to reproduce the problem in my test environment. Both of them run 1.3-milestone-1.7186. Please, do you know why this could happen? Thanks! Best regards, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
Hi Ricardo, Any page with groovy script inside must be saved by a user with programming rights to work. This is for security reasons. Thanks -Vincent On Feb 13, 2008, at 2:39 AM, [Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
Hi all,
We are facing a weird issue. The following code (provided the right host name, username and password)...
áéíóú
<% import groovy.sql.Sql db = Sql.newInstance("jdbc:mysql://hostname/database", "username", "password", "com.mysql.jdbc.Driver") List samplesIA = db.rows('SELECT * FROM saltmines s where es like "I" and ess like "A" and ids>=1') %>
Tomáronse un total de <% println "${samplesIA.size()}"%> mostras da secuencia sedimentaria do perfil P3-6-IA.
Edited by any user but admin with programming rights is rendered as...
http://mire.environmentalchange.net/~webmaster/images/RightCharaters.png
Edited by admin it is rendered this other way...
http://mire.environmentalchange.net/~webmaster/images/WrongCharacters.png
Please, not the question marks and the absence of the number 32.
This happens with any page containing Groovy code in this server, but I am not able to reproduce the problem in my test environment. Both of them run 1.3-milestone-1.7186.
Please, do you know why this could happen? Thanks!
Best regards,
Ricardo
-- Ricardo Rodríguez Your EPEC Network ICT Team
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Vincent Massol wrote:
Hi Ricardo,
Any page with groovy script inside must be saved by a user with programming rights to work. This is for security reasons.
Thanks, Vicent, I am aware of that. But take a look at the question marks. For any reason any accented vowel is rendered as a ? when the page is saved by an user with programming rigths. http://mire.environmentalchange.net/~webmaster/images/WrongCharacters.png The number 32 is the result of the correct evaluation of this simple script: <% println "${samplesIA.size()}"%> But all and any accented vowel is showed as ? Does this make any sense for you? It happens in any virtual server and in the controller as well. Thanks, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
[Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
Hi all,
We are facing a weird issue. The following code (provided the right host name, username and password)...
áéíóú
<% import groovy.sql.Sql db = Sql.newInstance("jdbc:mysql://hostname/database", "username", "password", "com.mysql.jdbc.Driver") List samplesIA = db.rows('SELECT * FROM saltmines s where es like "I" and ess like "A" and ids>=1') %>
Tomáronse un total de <% println "${samplesIA.size()}"%> mostras da secuencia sedimentaria do perfil P3-6-IA.
Edited by any user but admin with programming rights is rendered as...
http://mire.environmentalchange.net/~webmaster/images/RightCharaters.png
Edited by admin it is rendered this other way...
http://mire.environmentalchange.net/~webmaster/images/WrongCharacters.png
Please, not the question marks and the absence of the number 32.
This happens with any page containing Groovy code in this server, but I am not able to reproduce the problem in my test environment. Both of them run 1.3-milestone-1.7186.
Please, do you know why this could happen? Thanks!
Best regards,
Ricardo
Probably an encoding issue. Can you check the values of: - file.encoding jvm property - xwiki.encoding in xwiki.cfg -- Sergiu Dumitriu http://purl.org/net/sergiu/
Sergiu Dumitriu wrote:
Probably an encoding issue. Can you check the values of: - file.encoding jvm property - xwiki.encoding in xwiki.cfg
Hi Sergiu: It is easy to find the xwiki.encoding value. Here it is: xwiki.encoding=ISO-8859-1 But I am not sure about what value I must give you as file.encoding jvm property. I've not URIEncoding in the Tomcat connector, and I don't find any file.encoding thing in catalina.sh. Please, could you tell me where must I look for this value? Tomcat's web.xml reads <?xml version="1.0" encoding="ISO-8859-1"?>. No encoding find in catania.sh, nor in startup.sh. A simple .jsp gives us the file.encoding value as: System.getProperty("file.encoding"): ANSI_X3.4-1968 OutputStreamWriter encoding is: ASCII I've not touched neither Tomcat nor XWiki encoding default configuration. Or at least I am not aware of that. But the curiouse is that this server has been working apparently fine (concerning encoding) until the last update. I know this is not a XWiki issue, but any help will be really welcome. Thank you so much, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
[Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
Sergiu Dumitriu wrote:
Probably an encoding issue. Can you check the values of: - file.encoding jvm property - xwiki.encoding in xwiki.cfg
Hi Sergiu:
It is easy to find the xwiki.encoding value. Here it is:
xwiki.encoding=ISO-8859-1
But I am not sure about what value I must give you as file.encoding jvm property. I've not URIEncoding in the Tomcat connector, and I don't find any file.encoding thing in catalina.sh. Please, could you tell me where must I look for this value?
Tomcat's web.xml reads <?xml version="1.0" encoding="ISO-8859-1"?>. No encoding find in catania.sh, nor in startup.sh.
A simple .jsp gives us the file.encoding value as:
System.getProperty("file.encoding"): ANSI_X3.4-1968
Yep, that's the value I'm interested in. If you can change the tomcat settings, can you you add -Dfile.encoding=ISO-8859-1, restart tomcat and test again?
OutputStreamWriter encoding is: ASCII
I've not touched neither Tomcat nor XWiki encoding default configuration. Or at least I am not aware of that.
But the curiouse is that this server has been working apparently fine (concerning encoding) until the last update.
Was the script working correctly before the update, or you didn't try that script before? Because theoretically we didn't change anything in the groovy rendering process.
I know this is not a XWiki issue, but any help will be really welcome.
Thank you so much,
Ricardo
-- Sergiu Dumitriu http://purl.org/net/sergiu/
Sergiu Dumitriu wrote:
Yep, that's the value I'm interested in. If you can change the tomcat settings, can you you add -Dfile.encoding=ISO-8859-1, restart tomcat and test again?
I can not do that right now, but I will add the parameter, try again and report back as soon as possible
Was the script working correctly before the update, or you didn't try that script before? Because theoretically we didn't change anything in the groovy rendering process.
The script has always worked fine. The problem are the question marks substituting the special characters when the page including the script is edited by a "programmer". I don't know what this could mean. And, I insist, this only happens in one installation. I will try by adding the file.encoding parameter and report back ASAP. Thanks!! -- Ricardo Rodríguez Your EPEC Network ICT Team
Sergiu Dumitriu wrote:
Yep, that's the value I'm interested in. If you can change the tomcat settings, can you you add -Dfile.encoding=ISO-8859-1, restart tomcat and test again?
Hi, Changes done and problem solved! The scrip is executed and the text rendered correctly by adding -Dfile.encoding=ISO-8859-1 to JAVA_OPTS in catalina.sh. Sorry for not being able to solve it by myself following http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Encoding Now, xwiki.cfg reads... xwiki.encoding=ISO-8859-1 And Tomcat... System.getProperty("file.encoding"): ISO-8859-1 OutputStreamWriter encoding is: ISO8859_ No charset has been set for MySQL, so I guess it is running latin1 and latin1_swedish_ci as default collation. Don't you think that it could be advisable to write a warning somewhere about the need of setting up the servlet container for a given encoding? I've not touched this settings here, and what we get was a Tomcat installation with MacRoman by default and the other one with ASCII. Thanks for your help, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
[Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
Sergiu Dumitriu wrote:
Yep, that's the value I'm interested in. If you can change the tomcat settings, can you you add -Dfile.encoding=ISO-8859-1, restart tomcat and test again?
Hi,
Changes done and problem solved! The scrip is executed and the text rendered correctly by adding -Dfile.encoding=ISO-8859-1 to JAVA_OPTS in catalina.sh. Sorry for not being able to solve it by myself following http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Encoding
Now, xwiki.cfg reads...
xwiki.encoding=ISO-8859-1
And Tomcat...
System.getProperty("file.encoding"): ISO-8859-1 OutputStreamWriter encoding is: ISO8859_
No charset has been set for MySQL, so I guess it is running latin1 and latin1_swedish_ci as default collation.
Don't you think that it could be advisable to write a warning somewhere about the need of setting up the servlet container for a given encoding? I've not touched this settings here, and what we get was a Tomcat installation with MacRoman by default and the other one with ASCII.
Thanks for your help,
Ricardo
Actually, we're trying to make this automatic, so that no system settings must be changed. I hope this will work in the final 1.3 release. -- Sergiu Dumitriu http://purl.org/net/sergiu/
participants (3)
-
[Ricardo Rodriguez] Your EPEC Network ICT Team -
Sergiu Dumitriu -
Vincent Massol