We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Iirc, rawurlencode() can’t be used on a path containing slash characters, so we’d have to split the alias, encode it, and put it back together again if it contained slashes.

    After that, I think we might be able to do the following on everything (it should leave ASCII characters alone):

    $alias = rawurlencode(utf8_encode($alias)); 


    If not, this might be another way to go:

    if (isUTF8($alias) {
        $alias = rawurlencode($alias);
    }
    
    function isUTF8($string)
    {
        return (utf8_encode(utf8_decode($string)) == $string);
    }
    



      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 23525
      • 7 Posts
      Ok, at least in 0.9.6.2, the problem with charset in the Manager is located in: manager/includes/extenders/dbapi.mysql.class.inc.php. The variable $database_connection_method is not available to the method connect(). This seems to have been addressed at least in the SVN trunk. For people with 0.9.6.2, you can use instead:

      //@mysql_query("{$database_connection_method']} {$charset}", $this->conn);
      mysql_query($GLOBALS['database_connection_method'].' '.$charset, $this->conn);
      


      This kind of thing would have been caught, if error_reporting() was not silencing E_NOTICEs and if the code didn’t use @ to locally silence warnings/notices.

      Also addressed in SVN is the use of mysql_real_string_escape() (via DBAPI::escape()) in manager/processors/save_content_processor.php instead of straight mysql_string_escape()

      Repeat changes simlar to below to other mysql_string_escape() calls in that file.
      //$introtext = mysql_string_escape($_POST['introtext']);
      $introtext = $modx->db->escape($_POST['introtext']);
      


      That was a super annoying bug to say the least.

      Now, gonna check if that fixes the site title, and some issues with keywords with non-ASCII characters...
      • If it’s truly UTF8 data, and UTF8 collations, then the following should work:
        $database_connection_charset = 'utf8';
        $database_connection_method = 'SET CHARACTER SET';
        
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me