Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2017
    Location
    Tokyo, Japan
    Posts
    263
    Plugin Contributions
    0

    Default zen_trunc_string required multibyte functions

    ZenCart 1.5.6c, MariaDB 10.3.20, PHP 7.3.11

    Hi all,
    I noticed my Japanese products strangely truncated in sideboxes, and concluded the culprit was the zen_trunc_string function in includes/functions/functions_general.php
    Searching online and the forums, I saw this had already been covered in 2017 here:
    https://www.zen-cart.com/showthread....-String-Length
    Changing the 7 instances of substr and strlen into their multibyte equivalents solved the problem for me also.
    lat9 had submitted a pull request at that time, but clearly it did not make it into 1.5.5c or later.
    Looking at the PR, Dr. Byte noted that implementing this throughout Zen Cart this is a large job.
    Still, it certainly helps to change just this particular function.
    At least a solution is available, even if it is not implemented soon throughout the application.
    Last edited by gernot; 24 Nov 2019 at 02:04 PM.
    Zen Cart 1.5.6c modified to support Japanese language (postage module support work in progress). Upgraded incrementally each version from initial 1.5.5d.

  2. #2
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: zen_trunc_string required multibyte functions

    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  3. #3
    Join Date
    Feb 2017
    Location
    Tokyo, Japan
    Posts
    263
    Plugin Contributions
    0

    Default Re: zen_trunc_string required multibyte functions

    Ouch, looking at the reply from Dr. Byte there. So these fixes are not so straightforward to roll out because of hosting issues.
    Zen Cart 1.5.6c modified to support Japanese language (postage module support work in progress). Upgraded incrementally each version from initial 1.5.5d.

  4. #4
    Join Date
    Feb 2017
    Location
    Tokyo, Japan
    Posts
    263
    Plugin Contributions
    0

    Default Re: zen_trunc_string required multibyte functions

    [ZC 1.5.6c, PHP7.3.15]
    A follow-up. I found that in my Japanese products listing, the description (class=listingDescription) for several products ended up as plain "...".
    The culprit is function zen_trunc_string in includes/functions/functions_general.php.

    I tried various changes, like adding 'UTF-8' to the mb_* functions in that function, to no avail.
    I finally ended up commenting out the backtracking which obviously was removing the entire description in some cases.
    Code:
    // backtrack
           //while(mb_strlen($str) && ($str[mb_strlen($str)-1] != " ")) {
           //  $str = mb_substr($str, 0, -1);
           //}
    So now my descriptions work again, hopefully the backtrack not being there will not be detrimental (edge case which could be corrected in the actual description if needed.).

    Note, that is in addition to the mb_* changes already implemented previously from
    https://www.zen-cart.com/showthread....-String-Length
    Zen Cart 1.5.6c modified to support Japanese language (postage module support work in progress). Upgraded incrementally each version from initial 1.5.5d.

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default Re: zen_trunc_string required multibyte functions

    Quote Originally Posted by gernot View Post
    Ouch, looking at the reply from Dr. Byte there. So these fixes are not so straightforward to roll out because of hosting issues.
    FWIW, I've just updated that Zen Cart issue with a forward-going suggestion.

 

 

Similar Threads

  1. Reviews sidebox nl2br before zen_trunc_string
    By pasi in forum Bug Reports
    Replies: 0
    Last Post: 4 Mar 2013, 08:36 AM
  2. Replies: 1
    Last Post: 19 Sep 2012, 04:11 AM
  3. v150 Multibyte functions usage
    By gob33 in forum Bug Reports
    Replies: 3
    Last Post: 8 Feb 2012, 05:36 AM
  4. CURL functions not found - required for Linkpoint API payment module
    By batwyj in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 5 Jul 2007, 05:42 AM
  5. CURL functions not found - required for Linkpoint API payment module
    By raino in forum Managing Customers and Orders
    Replies: 1
    Last Post: 2 Dec 2006, 04:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR