[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wsf-c-dev
Subject:    Re: [Dev] Encoding issue in JSPs
From:       Farasath Ahamed <farasatha () wso2 ! com>
Date:       2016-07-31 18:26:31
Message-ID: CAPqAaPrGpMMOiLoGky=NTA6Kj0_zZ1z-h5sBtog9Td1WVdRkLQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

With the help of Jayanga and Rasika I was able to find the root cause of
the issue. I compared the web.xml (found at
IS_HOME/repository/conf/tomcat/carbon/) files of IS packs build on top of
Kernel 4.4.5 and 4.4.7. I noticed that the filter mapping for the "
*CharsetFilter*" was missing in IS packs built on top of 4.4.7 kernel. The
reason for this being that the particular entry has been missed out while
adding other product specific changes in the distribution.xml of product-is.

    <filter-mapping>
        <filter-name>CharsetFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

After adding the above entry manually to the web.xml file encoding worked
fine as expected. Created a JIRA[1] to track this and fix properly.


Thanks everyone for the help :)


[1] https://wso2.org/jira/browse/IDENTITY-4881

Farasath Ahamed
Software Engineer, WSO2 Inc.; http://wso2.com
Mobile: +94777603866
Blog: blog.farazath.com
Twitter: @farazath619 <https://twitter.com/farazath619>
<http://wso2.com/signature>



On Fri, Jul 29, 2016 at 6:56 PM, Farasath Ahamed <farasatha@wso2.com> wrote:

> Hi Lakshman,
>
> I tried the same by writing two simple JSPs it worked as expected. I tried
> setting the encoding as you suggested that didn't work either. The problem
> is only seen with JSPs that are exposed from a UI bundle.
>
>
> Thanks,
>
> Farasath Ahamed
> Software Engineer, WSO2 Inc.; http://wso2.com
> Mobile: +94777603866
> Blog: blog.farazath.com
> Twitter: @farazath619 <https://twitter.com/farazath619>
> <http://wso2.com/signature>
>
>
>
> On Fri, Jul 29, 2016 at 3:07 PM, Lakshman Udayakantha <lakshmanu@wso2.com>
> wrote:
>
>> Hi Farasath,
>>
>> I sent a request from a UTF-8 encoded form to a JSP page both from 4.4.5
>> kernel and 4.4.7 kernel and I got UTF-8 encoded text in JSP end without any
>> issue in both cases. BTW I have set following property in JSP before
>> reading request parameters
>>
>> request.setCharacterEncoding("UTF-8");
>>
>> Could you check by setting that too?
>>
>> Thanks
>>
>> On Tue, Jul 26, 2016 at 11:58 AM, Farasath Ahamed <farasatha@wso2.com>
>> wrote:
>>
>>> + Kishanthan, Johann
>>>
>>> Farasath Ahamed
>>> Software Engineer, WSO2 Inc.; http://wso2.com
>>> Mobile: +94777603866
>>> Blog: blog.farazath.com
>>> Twitter: @farazath619 <https://twitter.com/farazath619>
>>> <http://wso2.com/signature>
>>>
>>>
>>>
>>> On Tue, Jul 26, 2016 at 11:22 AM, Farasath Ahamed <farasatha@wso2.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am sending some UTF-8 encoded texts from a form to a JSP(ajax
>>>> processor). In the JSP I read the request parameters using,
>>>>
>>>> String emailSubject = request.getParameter("emailSubject");
>>>> String emailBody = request.getParameter("emailBody");
>>>> String emailFooter = request.getParameter("emailFooter");
>>>>
>>>> This scenario works fine with IS 5.3.0-M1 which is based on 4.4.5
>>>> kernel. But when I run the same code without any changes on IS 5.3.0-M3
>>>> which is based on 4.4.7 encoding doesn't seem to work.
>>>>
>>>> Appreciate your help to find the root cause.
>>>>
>>>>
>>>> Thanks,
>>>> Farasath Ahamed
>>>> Software Engineer, WSO2 Inc.; http://wso2.com
>>>> Mobile: +94777603866
>>>> Blog: blog.farazath.com
>>>> Twitter: @farazath619 <https://twitter.com/farazath619>
>>>> <http://wso2.com/signature>
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Lakshman Udayakantha
>> WSO2 Inc. www.wso2.com
>> lean.enterprise.middleware
>> Mobile: *0717429601*
>>
>>
>

[Attachment #5 (text/html)]

<div dir="ltr">Hi,<div><br></div><div>With the help of Jayanga and Rasika I was able \
to find the root cause of the issue. I compared the web.xml  (found at \
IS_HOME/repository/conf/tomcat/carbon/) files of IS packs build on top of Kernel \
4.4.5 and 4.4.7. I noticed that the filter mapping for the \
&quot;<b>CharsetFilter</b>&quot; was missing in IS packs built on top of 4.4.7 \
kernel. The reason for this being that the particular entry has been missed out while \
adding other product specific changes in the distribution.xml of \
product-is.</div><div><br></div><div><div>      &lt;filter-mapping&gt;</div><div>     \
&lt;filter-name&gt;CharsetFilter&lt;/filter-name&gt;</div><div>            \
&lt;url-pattern&gt;/*&lt;/url-pattern&gt;</div><div>      \
&lt;/filter-mapping&gt;</div></div><div><br></div><div>After adding the above entry \
manually to the web.xml file encoding worked fine as expected. Created a JIRA[1] to \
track this and fix properly.</div><div><br></div><div><br></div><div>Thanks everyone \
for the help :)</div><div><br></div><div><br></div><div>[1]  <a \
href="https://wso2.org/jira/browse/IDENTITY-4881">https://wso2.org/jira/browse/IDENTITY-4881</a></div><div \
class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div \
dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div \
dir="ltr"><div dir="ltr"><div dir="ltr" \
style="color:rgb(136,136,136);font-size:12.8px"><div><div><div>Farasath \
Ahamed<br></div>Software Engineer,  <span style="font-size:12.8px">WSO2 Inc.;  \
</span><a href="http://wso2.com/" style="font-size:12.8px;color:rgb(17,85,204)" \
target="_blank">http://wso2.com</a></div><div><span style="font-size:12.8px">Mobile:  \
</span><a href="tel:%2B94777603866" value="+94713149860" \
style="font-size:12.8px;color:rgb(17,85,204)" \
target="_blank">+94777603866</a><br></div></div><div>Blog:  <a \
href="http://blog.farazath.com" \
target="_blank">blog.farazath.com</a></div></div><div><span \
style="color:rgb(136,136,136);font-size:12.8px">Twitter: <a \
href="https://twitter.com/farazath619" \
target="_blank">@farazath619</a></span></div><div><a href="http://wso2.com/signature" \
target="_blank"><img \
src="http://c.content.wso2.com/signatures/wso2-signature-general.png" \
style="font-size: 12.8px;"></a><br></div><div><br></div></div></div></div></div></div></div></div></div></div><a \
href="http:///" target="_blank"></a><span></span><span></span><br></div></div></div> \
<br><div class="gmail_quote">On Fri, Jul 29, 2016 at 6:56 PM, Farasath Ahamed <span \
dir="ltr">&lt;<a href="mailto:farasatha@wso2.com" \
target="_blank">farasatha@wso2.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Lakshman,<div><br></div><div>I \
tried the same by writing two simple JSPs it worked as expected. I tried setting the \
encoding as you suggested that didn&#39;t work either. The problem is only seen with \
JSPs that are exposed from a UI bundle.  \
</div><div><br></div><div><br></div><div>Thanks,</div></div><div \
class="gmail_extra"><span class="gmail-"><br clear="all"><div><div><div \
dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div \
dir="ltr"><div dir="ltr"><div dir="ltr" \
style="color:rgb(136,136,136);font-size:12.8px"><div><div><div>Farasath \
Ahamed<br></div>Software Engineer,  <span style="font-size:12.8px">WSO2 Inc.;  \
</span><a href="http://wso2.com/" style="font-size:12.8px;color:rgb(17,85,204)" \
target="_blank">http://wso2.com</a></div><div><span style="font-size:12.8px">Mobile:  \
</span><a href="tel:%2B94777603866" value="+94713149860" \
style="font-size:12.8px;color:rgb(17,85,204)" \
target="_blank">+94777603866</a><br></div></div><div>Blog:  <a \
href="http://blog.farazath.com" \
target="_blank">blog.farazath.com</a></div></div><div><span \
style="color:rgb(136,136,136);font-size:12.8px">Twitter: <a \
href="https://twitter.com/farazath619" \
target="_blank">@farazath619</a></span></div><div><a href="http://wso2.com/signature" \
target="_blank"><img \
src="http://c.content.wso2.com/signatures/wso2-signature-general.png" \
style="font-size: 12.8px;"></a><br></div><div><br></div></div></div></div></div></div></div></div></div></div><a \
href="http:///" target="_blank"></a><span></span><span></span><br></div></div></div> \
<br></span><div><div class="gmail-h5"><div class="gmail_quote">On Fri, Jul 29, 2016 \
at 3:07 PM, Lakshman Udayakantha <span dir="ltr">&lt;<a \
href="mailto:lakshmanu@wso2.com" target="_blank">lakshmanu@wso2.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi \
Farasath,<div><br></div><div>I sent a request from a UTF-8 encoded form to a JSP page \
both from 4.4.5 kernel and 4.4.7 kernel and I got UTF-8 encoded text in JSP end \
without any issue in both cases. BTW I have set following property in JSP before \
reading request parameters</div><div><pre \
style="color:rgb(0,0,0);font-family:menlo;font-size:9pt"><span \
style="background-color:rgb(247,250,255)">request.setCharacterEncoding(</span><span \
style="color:rgb(0,128,0);font-weight:bold;background-color:rgb(247,250,255)">&quot;UTF-8&quot;</span><span \
style="background-color:rgb(247,250,255)">);</span></pre></div><div>Could you check \
by setting that too?  </div><div><br></div><div>Thanks</div></div><div \
class="gmail_extra"><br><div class="gmail_quote"><div><div>On Tue, Jul 26, 2016 at \
11:58 AM, Farasath Ahamed <span dir="ltr">&lt;<a href="mailto:farasatha@wso2.com" \
target="_blank">farasatha@wso2.com</a>&gt;</span> wrote:<br></div></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr">+ Kishanthan, \
Johann</div><div class="gmail_extra"><span><br clear="all"><div><div><div \
dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div \
dir="ltr"><div dir="ltr"><div dir="ltr" \
style="color:rgb(136,136,136);font-size:12.8px"><div><div><div>Farasath \
Ahamed<br></div>Software Engineer,  <span style="font-size:12.8px">WSO2 Inc.;  \
</span><a href="http://wso2.com/" style="font-size:12.8px;color:rgb(17,85,204)" \
target="_blank">http://wso2.com</a></div><div><span style="font-size:12.8px">Mobile:  \
</span><a href="tel:%2B94777603866" value="+94713149860" \
style="font-size:12.8px;color:rgb(17,85,204)" \
target="_blank">+94777603866</a><br></div></div><div>Blog:  <a \
href="http://blog.farazath.com" \
target="_blank">blog.farazath.com</a></div></div><div><span \
style="color:rgb(136,136,136);font-size:12.8px">Twitter: <a \
href="https://twitter.com/farazath619" \
target="_blank">@farazath619</a></span></div><div><a href="http://wso2.com/signature" \
target="_blank"><img \
src="http://c.content.wso2.com/signatures/wso2-signature-general.png" \
style="font-size: 12.8px;"></a><br></div><div><br></div></div></div></div></div></div></div></div></div></div><a \
href="http:///" target="_blank"></a><span></span><span></span><br></div></div></div> \
<br></span><div><div><div class="gmail_quote">On Tue, Jul 26, 2016 at 11:22 AM, \
Farasath Ahamed <span dir="ltr">&lt;<a href="mailto:farasatha@wso2.com" \
target="_blank">farasatha@wso2.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>I \
am sending some UTF-8 encoded texts from a form to a JSP(ajax processor). In the JSP \
I read the request parameters using,</div><div><br></div><div><pre \
style="color:rgb(0,0,0);font-family:&quot;dejavu sans mono&quot;;font-size:9pt"><span \
style="background-color:rgb(247,250,255)">String emailSubject = \
request.getParameter(</span><span \
style="color:rgb(0,128,0);font-weight:bold;background-color:rgb(247,250,255)">&quot;emailSubject&quot;</span><span \
style="background-color:rgb(247,250,255)">);<br></span><span \
style="background-color:rgb(247,250,255)">String emailBody = \
request.getParameter(</span><span \
style="color:rgb(0,128,0);font-weight:bold;background-color:rgb(247,250,255)">&quot;emailBody&quot;</span><span \
style="background-color:rgb(247,250,255)">);<br></span><span \
style="background-color:rgb(247,250,255)">String emailFooter = \
request.getParameter(</span><span \
style="color:rgb(0,128,0);font-weight:bold;background-color:rgb(247,250,255)">&quot;emailFooter&quot;</span><span \
style="background-color:rgb(247,250,255)">);</span></pre>This scenario works fine \
with IS 5.3.0-M1 which is based on 4.4.5 kernel. But when I run the same code without \
any changes on IS 5.3.0-M3 which is based on 4.4.7 encoding doesn&#39;t seem to \
work.</div><div><br></div><div>Appreciate your help to find the root \
cause.</div><div><br></div><div><br></div>Thanks,<br clear="all"><div><div><div \
dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div \
dir="ltr"><div dir="ltr"><div dir="ltr" \
style="color:rgb(136,136,136);font-size:12.8px"><div><div><div>Farasath \
Ahamed<br></div>Software Engineer,  <span style="font-size:12.8px">WSO2 Inc.;  \
</span><a href="http://wso2.com/" style="font-size:12.8px;color:rgb(17,85,204)" \
target="_blank">http://wso2.com</a></div><div><span style="font-size:12.8px">Mobile:  \
</span><a href="tel:%2B94777603866" value="+94713149860" \
style="font-size:12.8px;color:rgb(17,85,204)" \
target="_blank">+94777603866</a><br></div></div><div>Blog:  <a \
href="http://blog.farazath.com" \
target="_blank">blog.farazath.com</a></div></div><div><span \
style="color:rgb(136,136,136);font-size:12.8px">Twitter: <a \
href="https://twitter.com/farazath619" \
target="_blank">@farazath619</a></span></div><div><a href="http://wso2.com/signature" \
target="_blank"><img \
src="http://c.content.wso2.com/signatures/wso2-signature-general.png" \
style="font-size: 12.8px;"></a><br></div><div><br></div></div></div></div></div></div></div></div></div></div><a \
href="http:///" target="_blank"></a><span></span><span></span><br></div></div></div> \
</div> </blockquote></div><br></div></div></div>
<br></div></div>_______________________________________________<br>
Dev mailing list<br>
<a href="mailto:Dev@wso2.org" target="_blank">Dev@wso2.org</a><br>
<a href="http://wso2.org/cgi-bin/mailman/listinfo/dev" rel="noreferrer" \
target="_blank">http://wso2.org/cgi-bin/mailman/listinfo/dev</a><br> \
<br></blockquote></div><span><font color="#888888"><br><br \
clear="all"><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div><div \
dir="ltr">Lakshman Udayakantha<div>WSO2 Inc.  <a href="http://www.wso2.com" \
target="_blank">www.wso2.com</a></div><div>lean.enterprise.middleware</div><div>Mobile: \
<u>0717429601</u><div><div><u><br></u></div></div></div></div></div></div></div></div></div>
 </font></span></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div>



_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic