Thread: search UTF8

Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Location
    vienna
    Posts
    198
    Plugin Contributions
    9

    Default search UTF8

    searching for umlauts ( like äöü...) doesnt bring any result

    because the function zen_parse_search_string converts the searchString to lower, the search fails because the php-function strtolower is not utf8 safe

    solution:

    1.removing strtolower; mysql is not case sensitive
    PHP Code:
    // Parse search string into indivual objects
    function zen_parse_search_string($search_str '', &$objects) {
        
    $search_str trim(($search_str)); 
    2.
    PHP Code:
    // Parse search string into indivual objects
      
    function zen_parse_search_string($search_str '', &$objects) {
        
    $search_str trim(strtolower_utf8($search_str));
    ..........
    function 
    strtolower_utf8($inputString) {
        
    // http://de.php.net/manual/de/function.strtolower.php#78560
        
    $outputString    utf8_decode($inputString);
        
    $outputString    strtolower($outputString);
        
    $outputString    utf8_encode($outputString);
        return 
    $outputString;


  2. #2
    Join Date
    Aug 2004
    Location
    Saint Petersburg, Russia
    Posts
    1,786
    Plugin Contributions
    13

    Default Re: search UTF8

    Bette use mb_strtolower() function.

  3. #3
    Join Date
    Apr 2004
    Location
    vienna
    Posts
    198
    Plugin Contributions
    9

    Default Re: search UTF8

    Quote Originally Posted by a_berezin View Post
    Bette use mb_strtolower() function.
    yes I know the mbstring functions, but: I prefer a general solution; mbstring is a non-default extension ( http://de.php.net/manual/de/mbstring.installation.php )
    because I use on my host egroupware, there is a need to use mbstring & I have to set in php.ini
    Code:
    mbstring.func_overload = 7
    ( http://de.php.net/manual/de/mbstring.overload.php )
    if I also set
    Code:
    mbstring.internal_encoding = UTF-8
    then there is no need to change the zen-cart code

    if you use mbstring without the ini-changes, you have to write
    PHP Code:
      function zen_parse_search_string($search_str '', &$objects) {
        
    $search_str trim(mb_strtolower($search_str'UTF-8')); 
    but I think the safest way is to eliminate the strtolower conversion, i cannot see any need for this

  4. #4
    Join Date
    Aug 2004
    Location
    Saint Petersburg, Russia
    Posts
    1,786
    Plugin Contributions
    13

    Default Re: search UTF8

    You are deeply mistaken if you think that the whole world lives only in the ISO-8859-1. It should therefore be used multibaytovye function.
    In <language>.php:
    Code:
      define('CHARSET', 'utf-8');
      mb_internal_encoding('UTF-8');

 

 

Similar Threads

  1. v151 UTF8 Conversion
    By Rick5150 in forum Upgrading to 1.5.x
    Replies: 1
    Last Post: 31 Dec 2013, 06:25 PM
  2. v150 A few UTF8 questions
    By hubert in forum Upgrading to 1.5.x
    Replies: 8
    Last Post: 14 Apr 2012, 05:25 AM
  3. UTF8 new installation
    By tony_sar in forum Installing on a Windows Server
    Replies: 1
    Last Post: 7 May 2009, 12:28 AM
  4. UTF8 and Number
    By nnitin in forum Addon Language Packs
    Replies: 5
    Last Post: 24 Nov 2008, 01:14 PM
  5. UTF8 problems with Advanced Search
    By saskvo4 in forum Addon Language Packs
    Replies: 8
    Last Post: 16 Jan 2008, 09:35 AM

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