[jira] [Comment Edited] (OFBIZ-5383) Utf8 error in front site ecommerce

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Comment Edited] (OFBIZ-5383) Utf8 error in front site ecommerce

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-5383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13813610#comment-13813610 ]

Rong Nguyen edited comment on OFBIZ-5383 at 11/5/13 3:57 AM:
-------------------------------------------------------------

I have resolved this problem by adding a litter code in org.ofbiz.product.category.CatalogURLFilter.java
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
       
                //  from olbius    
                String charset = config.getInitParameter("encoding");
        if (UtilValidate.isEmpty(charset)) charset = request.getCharacterEncoding();
        if (UtilValidate.isEmpty(charset)) charset = "UTF-8";
        if (Debug.verboseOn()) Debug.logVerbose("The character encoding of the request is: [" + request.getCharacterEncoding() + "]. The character encoding we will use for the request and response is: [" + charset + "]", module);

        if (!"none".equals(charset)) {
            request.setCharacterEncoding(charset);
        }

        // setup content type
        String contentType = config.getInitParameter("contenttype");
        if (UtilValidate.isEmpty(contentType)) contentType = request.getContentType();
        if (UtilValidate.isEmpty(contentType)) contentType = "text/html";
        if (charset.length() > 0 && !"none".equals(charset)) {
            response.setContentType(contentType + "; charset=" + charset);
            response.setCharacterEncoding(charset);
        } else {
            response.setContentType(contentType);
        }
                // End from Olbius


was (Author: rongnk):
I have resolved this problem by adding a litter code in org.ofbiz.product.category.CatalogURLFilter.java
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
       
                // extra from olbius    
                String charset = config.getInitParameter("encoding");
        if (UtilValidate.isEmpty(charset)) charset = request.getCharacterEncoding();
        if (UtilValidate.isEmpty(charset)) charset = "UTF-8";
        if (Debug.verboseOn()) Debug.logVerbose("The character encoding of the request is: [" + request.getCharacterEncoding() + "]. The character encoding we will use for the request and response is: [" + charset + "]", module);

        if (!"none".equals(charset)) {
            request.setCharacterEncoding(charset);
        }

        // setup content type
        String contentType = config.getInitParameter("contenttype");
        if (UtilValidate.isEmpty(contentType)) contentType = request.getContentType();
        if (UtilValidate.isEmpty(contentType)) contentType = "text/html";
        if (charset.length() > 0 && !"none".equals(charset)) {
            response.setContentType(contentType + "; charset=" + charset);
            response.setCharacterEncoding(charset);
        } else {
            response.setContentType(contentType);
        }
                // End

> Utf8 error in front site ecommerce
> ----------------------------------
>
>                 Key: OFBIZ-5383
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5383
>             Project: OFBiz
>          Issue Type: Bug
>          Components: specialpurpose/ecommerce
>    Affects Versions: SVN trunk
>         Environment: Ubuntu 13.10
>            Reporter: Rong Nguyen
>
> When i register new user, if i input utf8 format(Vietnamese) for content, the content will have error content.
> For example: if i input "Hà Nội", the content after saving will be "Hà Ná» i"



--
This message was sent by Atlassian JIRA
(v6.1#6144)