We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5811
    • 1,717 Posts
    Adik, I am not a specialist of charset, but if it is as for french you have ’latin1’ as $database_connection_charset in your config file and ISO-8859-1 as charset for your html page.

    So for Central european language i think you need to have ’latin2’ as $database_connection_charset in your config file and ISO-8859-2 as charset for your html page. Look at http://dev.mysql.com/doc/refman/5.0/en/charset-mysql.html
      • 477
      • 19 Posts
      Ok, I try as you suggest:

      ’latin2’ as $database_connection_charset
      ’ISO-8859-2’ for my html page

      but I have a error

      Warning: htmlentities() [function.htmlentities]: charset `ISO-8859-2' not supported, assuming iso-8859-1 in /home/pcpedia/ftp/assets/snippets/ajaxSearch/ajaxSearch.php on line 163
      
      Warning: htmlentities() [function.htmlentities]: charset `ISO-8859-2' not supported, assuming iso-8859-1 in /home/pcpedia/ftp/assets/snippets/ajaxSearch/ajaxSearch.php on line 163
        • 5811
        • 1,717 Posts
        The Php function htmlentities seems not support iso-8859-2 >:(

        Look at : http://fr.php.net/manual/en/function.htmlentities.php.

        The simpliest way to solve these issues is to use the utf8 instead of iso-8859-2
          • 477
          • 19 Posts
          UTF-8 doesn’t work. >:(

          but I found this:

          I wrote usefull function which is support iso-8859-2 encoding with htmlentities function ;]

          <?php
          /*
           *    Function htmlentities which support iso-8859-2
           *
           *    @param string
           *    @return string
           *    @author FanFataL
           */
          function htmlentities_iso88592($string='') {
              $pl_iso = array('ê', 'ó', '±', '¶', '³', '¿', '¼', 'æ', 'ñ', 'Ê', 'Ó', '¡', '¦', '£', '¬', '¯', 'Æ', 'Ñ');   
              $entitles = get_html_translation_table(HTML_ENTITIES);
              $entitles = array_diff($entitles, $pl_iso);
              return strtr($string, $entitles);
          }
          ?>


          I make think where to put this function...
            • 477
            • 19 Posts
            Above problem with charset I see when I am using Ajax-mode.
            • Quote from: coroico at Apr 09, 2008, 08:17 AM

              Thanks Jako for this quick solution about this issue. I have already noticed it, but by lack of time, not investigate on it. This issue don’t occur with the non ajax-mode and as it didn’t exist with the previous version, is clearly a code regression >:(

              The issue in the Ajax part of AjaxSearch 1.7.1 has a second effect. If there are too much results while searching the more results link is wrong, too. Why do you (or whoever) do urlencode() and htmlentities() of the searched word in the url? Line 163 and 205 of ajaxSearch.php
                • 5811
                • 1,717 Posts
                Jako, the regression code between 1.7.0.2 and 1.7.1 comes from this post. To avoid this issue, I haven’t remove the call to the decodeURIComponent in the file js/ajaxSearch.js :
                  $('current-search-results').setHTML(decodeURIComponent(request));
                Since this update, as we use urlencode(htmlentities( call in ajaxSearch.php file, we get an error with accented character in url sad
                But i think we have to be coherent between php and js and use urlencode(htmlentities with decodeURIComponent(request) or use only (htmlentities without any code to decodeURIComponent.

                So I suggest to change urlencode(htmlentities by htmlentities line 163 and 205.
                Do the change and let me know if you have any new issues. Try to add a % character in your content and search a word just near. Thanks.
                  • 5811
                  • 1,717 Posts
                  Hi Jim,
                  I can’t reproduce this issue; Could you check if you could reproduce it on the demo site at http://www.modx.wangba.fr/more-results171.html

                  Which version of AS do you use and what snippet call do yo use. Have you an adress where to check this issue.
                  Thanks.
                    • 32645
                    • 377 Posts
                    I’ve noticed a bug. When you have a non-Ajax search and it returns a page full of results; it will also sometimes include parts of HTML.

                    For example in some searches I found that it returns part of a HTML <p>, or worse part of a HTML anchor (sometimes broken).

                    I’ve added a "strip_tags" on the following line;

                    $text=strip_tags($SearchFormsrc['content']);
                    


                    But would prefer a more powerful way to remove all HTML tags.

                    Thanks
                      • 5811
                      • 1,717 Posts
                      @Worchyld
                      When you have a non-Ajax search and it returns a page full of results; it will also sometimes include parts of HTML.

                      For example in some searches I found that it returns part of a HTML <p>, or worse part of a HTML anchor (sometimes broken).
                      Can you give a site address where I can examine this issue or at least (by personal message if needed) a copy of the document content.

                      In AS, html tags are stripped by the function PrepareSearchContent of the includes/ajaxsearch.inc.php file:
                      function PrepareSearchContent( $text ) {
                        // Remove modx sensitive tags
                        $text = stripSnip($text);
                      
                        // strips tags won't remove the actual jscript
                        $text = preg_replace( "'<script[^>]*>.*?</script>'si", "", $text );
                        $text = preg_replace( '/{.+?}/', '', $text);
                        // $text = preg_replace( '/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is','\2', $text );
                        // replace line breaking tags with whitespace
                        $text = preg_replace( "'<(br[^/>]*?/|hr[^/>]*?/|/(div|h[1-6]|li|p|td))>'si", ' ', $text );
                      
                        $text = stripHtml($text); // strip html tags. Tags should be correctly ended
                      
                        return $text;
                      }

                      Are you sure that your Html tags are well ended ?

                      This discussion is closed to further replies. Keep calm and carry on.