Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-6739

Can not display product category name in Unicode.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Later
    • Affects Version/s: Trunk
    • Fix Version/s: 16.11.01
    • Component/s: product
    • Labels:
      None

      Description

      Hi, All

      I found problem to display product category name in Unicode (Thai UTF-8) . The problem is services in CategoryContentWrapper are create content mimeType in "text/html". Then i try to fixed this problem by replace "text/html" with "text/html; charset=utf-8". After that i recompile and restart OFBiz the problem is disappear.

      Sorry for my English.

      Best Regard,
      Thanakrit

        Activity

        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Actually there is a CategoryContentWrapper constructor which allows to pass your own mime type. Could you be more explicit about the change you made, because there are no CategoryContentWrapper services in the OFBiz sense of service. I guess you did at least that:

        Index: applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java
        ===================================================================
        --- applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java	(revision 1714681)
        +++ applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java	(working copy)
        @@ -76,7 +76,7 @@
                 this.dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
                 this.productCategory = productCategory;
                 this.locale = UtilHttp.getLocale(request);
        -        this.mimeTypeId = "text/html";
        +        this.mimeTypeId = "text/html; charset=utf-8";
             }
        
             public StringUtil.StringWrapper get(String prodCatContentTypeId, String encoderType) {
        

        And maybe even this?

        Index: applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java
        ===================================================================
        --- applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java	(revision 1714681)
        +++ applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java	(working copy)
             public StringUtil.StringWrapper get(String prodCatContentTypeId, String encoderType) {
        @@ -85,7 +85,7 @@
        
             public static String getProductCategoryContentAsText(GenericValue productCategory, String prodCatContentTypeId, HttpServletRequest request, String encoderType) {
                 LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
        -        return getProductCategoryContentAsText(productCategory, prodCatContentTypeId, UtilHttp.getLocale(request), "text/html", productCategory.getDelegator(), dispatcher, encoderType);
        +        return getProductCategoryContentAsText(productCategory, prodCatContentTypeId, UtilHttp.getLocale(request), "text/html; charset=utf-8", productCategory.getDelegator(), dispatcher, encoderType);
             }
        
             public static String getProductCategoryContentAsText(GenericValue productCategory, String prodCatContentTypeId, Locale locale, LocalDispatcher dispatcher, String encoderType) {
        @@ -136,7 +136,7 @@
                 }
        
                 if (UtilValidate.isEmpty(mimeTypeId)) {
        -            mimeTypeId = "text/html";
        +            mimeTypeId = "text/html; charset=utf-8";
                 }
        
                 if (delegator == null) {
        

        It would be OK with me, but we might consider other opinions. Also this concerns not only the CategoryContentWrapper but all the 7 *ContentWrappers.

        I find your English not so bad, but I'm French so

        Show
        jacques.le.roux Jacques Le Roux added a comment - Actually there is a CategoryContentWrapper constructor which allows to pass your own mime type. Could you be more explicit about the change you made, because there are no CategoryContentWrapper services in the OFBiz sense of service. I guess you did at least that: Index: applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java =================================================================== --- applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java (revision 1714681) +++ applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java (working copy) @@ -76,7 +76,7 @@ this .dispatcher = (LocalDispatcher) request.getAttribute( "dispatcher" ); this .productCategory = productCategory; this .locale = UtilHttp.getLocale(request); - this .mimeTypeId = "text/html" ; + this .mimeTypeId = "text/html; charset=utf-8" ; } public StringUtil.StringWrapper get( String prodCatContentTypeId, String encoderType) { And maybe even this? Index: applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java =================================================================== --- applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java (revision 1714681) +++ applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java (working copy) public StringUtil.StringWrapper get( String prodCatContentTypeId, String encoderType) { @@ -85,7 +85,7 @@ public static String getProductCategoryContentAsText(GenericValue productCategory, String prodCatContentTypeId, HttpServletRequest request, String encoderType) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute( "dispatcher" ); - return getProductCategoryContentAsText(productCategory, prodCatContentTypeId, UtilHttp.getLocale(request), "text/html" , productCategory.getDelegator(), dispatcher, encoderType); + return getProductCategoryContentAsText(productCategory, prodCatContentTypeId, UtilHttp.getLocale(request), "text/html; charset=utf-8" , productCategory.getDelegator(), dispatcher, encoderType); } public static String getProductCategoryContentAsText(GenericValue productCategory, String prodCatContentTypeId, Locale locale, LocalDispatcher dispatcher, String encoderType) { @@ -136,7 +136,7 @@ } if (UtilValidate.isEmpty(mimeTypeId)) { - mimeTypeId = "text/html" ; + mimeTypeId = "text/html; charset=utf-8" ; } if (delegator == null ) { It would be OK with me, but we might consider other opinions. Also this concerns not only the CategoryContentWrapper but all the 7 *ContentWrappers. I find your English not so bad, but I'm French so
        Hide
        thanakrit Thanakrit Wongyued added a comment -

        Thank you so much Jacques Le Roux.

        Show
        thanakrit Thanakrit Wongyued added a comment - Thank you so much Jacques Le Roux.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        If nobody disagree, I will commit this fix soon. I will add a properties to externally set the mime type rather than harcoding it as above, even if I guess everybody want to use UTF-8, but who knows...

        Show
        jacques.le.roux Jacques Le Roux added a comment - If nobody disagree, I will commit this fix soon. I will add a properties to externally set the mime type rather than harcoding it as above, even if I guess everybody want to use UTF-8, but who knows...
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Fixed at r1716261. I did not backport in R14.12 (oloder are already out of scope see OFBIZ-6680) because I got too much conflicts while trying to close OFBIZ-6669

        Show
        jacques.le.roux Jacques Le Roux added a comment - Fixed at r1716261. I did not backport in R14.12 (oloder are already out of scope see OFBIZ-6680 ) because I got too much conflicts while trying to close OFBIZ-6669
        Hide
        thanakrit Thanakrit Wongyued added a comment -

        Thank you very much.

        Show
        thanakrit Thanakrit Wongyued added a comment - Thank you very much.

          People

          • Assignee:
            jacques.le.roux Jacques Le Roux
            Reporter:
            thanakrit Thanakrit Wongyued
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development