Re: [enhydra] Problem with UTF-8 on EE-6.5-1

Daniel Guryca <[email protected]> Wed, 28 Sep 2005 23:36:11 +0200
Newsgroups gmane.comp.java.enhydra.general
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1127944531-30191-140
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Slobodan Vujasinovic wrote:

> Hi Daniel,
>
> you will have to set 'response' encoding from your PO implementation 
> ('run(HttpPresentationComms myComms)' method)!
>
> In your case should look something like this:
> //Set the 'HttpPresentationResponse' output character encoding
> myComms.response.setEncoding("UTF-8");
>
> Additionally you are advised to set:
> //Overrides the name of the character encoding used in the body of 
> this request.
> //This method must be called prior to reading request parameters or 
> reading input using getReader()
> myComms.request.getHttpServletRequest().setCharacterEncoding("UTF-8");
>
> This should resolve your problem.
>
> I have attached simple Enhydra demo application that should clear out 
> this encoding issue.
> It is basic enhydra demo application extended with simple table.
> This table contains:
> 1. Encoding table - header row
> 2. Text Received - row that presents previously sent (UTF-8 encoded) text
> 3. text input field - where you can type your special characters
> 4. submit button - submits typed text as (POST) parameter which will 
> be shown in 'Text Received' row (on response page)
>
> You can check out "RedirectPresentation" PO object implementation!
> Here you can find useful code snippets managing cases when you are 
> using 'ClientPageRedirectException' or 'ServerPageRedirectException' 
> redirects with encoded requests.
>
> Initially, this application is implemented to use 
> "RedirectPresentation" PO object. You can manually edit 'options.xmlc' 
> file to change this default application behavior and use 
> "WelcomePresentation" PO object only (directly not trough 
> "RedirectPresentation").
>
> NOTE: This demo application is developed in EnhydraIDE (Eclipse 3.0 + 
> Kelp) that comes with Enhydra Enterprise 6.5-1 on Windows platform. To 
> rebuild this application (by using 'enhydra-ant' script) you will have 
> to change 'enhydra.dir' property setting defined in projects 
> 'build.xml' file (placed in root projects directory). Additionally, if 
> you want to load application in your EnhydraIDE installation you will 
> have to adapt absolute paths in '.project' and '.classpath' Eclipse 
> project files (depending of your local Enhydra Enterprise installation 
> path).
>
> Hope this helps!
> Any feedback is very welcome!
>
> Regards,
>  Slobodan Vujasinovic
> Enhydra Development Team
>
>
>
> Daniel Guryca wrote:
>
>> Michael Warne wrote:
>>
>>> Daniel, I think you should post this to the XMLC Group also.  It 
>>> sounds like an
>>> XMLC issue.
>>>
>>> To check if it is XMLC  you could create a simple java application, 
>>> that
>>> uses your XMLC page class.
>>> Modify your text node and write the output to stdout  or write it to
>>> disk.
>>> // This does Not Use Enhydra Application server code..
>>> // Only XMLC code.
>>> //
>>> public void main(String[] args) {
>>>     ExampleHTML page = new ExampleHTML();
>>>      // set the text node
>>>     page.getElementTest().getFirstChild().setNodeValue("Czech
>>> characters ... in utf-8");
>>>     System.out.print(page.toDocument());
>>> }
>>>
>>>
>>>
>>> Mike.
>>>
>>> -----Original Message-----
>>> From: Daniel Guryca [mailto:[email protected]] Sent: Tuesday, 
>>> September 27, 2005 9:19 AM
>>> To: [email protected]
>>> Subject: [enhydra] Problem with UTF-8 on EE-6.5-1
>>>
>>>
>>> Hi.
>>>
>>> I have a real problem with UTF-8 encoding in Enhydra Enterprise.
>>>
>>> I have set everything like this:
>>>
>>> 1) Change the HTML file to have this line:
>>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>>>
>>> 2) Add this line into xmlc file:
>>> -html:encoding utf-8
>>>
>>> 3) Add this line into presentation.conf:
>>> Application.Encoding = "utf-8"
>>>
>>> 4) Add this to server.xml -> URIEncoding="utf-8"
>>> ...
>>> <Connector port="9000"
>>> maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
>>> enableLookups="false" redirectPort="9043" acceptCount="100" debug="0"
>>> connectionTimeout="20000" URIEncoding="utf-8"
>>> disableUploadTimeout="true" />
>>>
>>> But I am still not able to get proper characters from my page request.
>>> Everything defined in html files (include utf-8 characters) is 
>>> printed properly but if I want to do this from my Example.java:
>>>
>>> ExampleHTML page = 
>>> (ExampleHTML)myComms.xmlcFactory.create(ExampleHTML.class);
>>> page.getElementTest().getFirstChild().setNodeValue("Czech characters 
>>> ...
>>>
>>> in utf-8");
>>>
>>> Final output printed for my page request are bad messed encoded 
>>> characters! But all utf-8 characters (untouched by java - set 
>>> statically in HTML file) are printed properly.
>>>
>>> Java 1.4.2-09 + EE6.5-1 + Tomcat + Eclipse 3.0.0 (included with EE) 
>>> running all these on standard Debian Sarge 3.1 with ISO8859-2 locales.
>>>
>>> Thank you for your advices.
>>>
>>>
>>>  
>>>
>>> ------------------------------------------------------------------------ 
>>>
>>>
>>>
>>> -- 
>>> You receive this message as a subscriber of the 
>>> [email protected] mailing list.
>>> To unsubscribe: mailto:[email protected]
>>> For general help: mailto:[email protected]?subject=help
>>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>>  
>>>
>> Thank you for your advice.
>> I have tried it, and result is that XMLC output is OK.
>> So it seems it is not a XMLC related problem.
>>
>> Another advices, please.
>>
>> ------------------------------------------------------------------------
>>
>>
>> -- 
>> You receive this message as a subscriber of the [email protected] 
>> mailing list.
>> To unsubscribe: mailto:[email protected]
>> For general help: mailto:[email protected]?subject=help
>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>  
>>
>------------------------------------------------------------------------
>
>
>--
>You receive this message as a subscriber of the [email protected] mailing list.
>To unsubscribe: mailto:[email protected]
>For general help: mailto:[email protected]?subject=help
>ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  
>
It does not solve my problem (cause I did not have any problem with 
POST, URL encoding). I have set all these 2 parameters before (I forgot 
to write it, sorry).

My problem has been solved by adding encoding attribute to 
build-deploy.xml file within javac tag. (Solved by Michal Strapp).

Thank you for your advice.


------------=_1127944531-30191-140
Content-Type: text/plain; name="message-footer.txt"
Content-Disposition: inline; filename="message-footer.txt"
Content-Transfer-Encoding: 8bit


--
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

------------=_1127944531-30191-140--