We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Has anybody successfully used a different language for the document’s alias? URLencoded?
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Ok, I made an ugly hack in the save_content.processor.php file; I commented out the line
          //$alias = preg_replace('/[^\.%A-Za-z0-9 _-]/', '', $alias);
      

      as well as changed all the instances of mysql_escape_string() to mysql_real_escape_string(). It’s working fine on my local MAMP server as well as my remote Linux virtual private server. I don’t know what the full ramifications of this would be; I suppose it would mean that a malicious manager user could put it some kind of evil alias? But then if one has a malicious manager, I would think that one would have bigger problems.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 22303 MODX Staff
        • 10,725 Posts
        I would refer to this for detailed information on allowing international characters in Resource Identifiers (also covers Domain Names):

        http://www.w3.org/International/articles/idn-and-iri/
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Read it; it’s a few years old. This works for Hebrew in FF and Safari; time will tell if it works otherwise. The site is in utf-8, which should help.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 5091
            • 332 Posts
            Correct me if I am wrong. Modx is UTF-8 by default correct? so if your database is utf-8 and the template uses utf-8 charaset, whatever language you type in in the alias, it should display properly in Safari, FF and Opera.

            Last year I did a Chinese site in Textpattern, the document names show up in Chinese properly. I checked IE but it was not, however, my friend, the site owner, who is using Chinese version XP, told me he can see the document name in Chinese from his IE.
              • 27147
              • 53 Posts
              Quote from: chinesedream at Jul 02, 2008, 06:44 PM

              Correct me if I am wrong. Modx is UTF-8 by default correct? so if your database is utf-8 and the template uses utf-8 charaset, whatever language you type in in the alias, it should display properly in Safari, FF and Opera.
              Yes. It’s not the utf-8 that’s the problem, but the potential for ’evil’ characters to be included in the alias.

              Looking at that W3C doc though, it seems like the bulk of the stripAlias() function could be replaced by a regex similar to:
              /[^\.%\p{L}\p{N} _-]/u

              Then again, maybe the /u modifier is not secure enough?:
              http://php.net/manual/en/reference.pcre.pattern.modifiers.php#54805
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Quote from: chinesedream at Jul 02, 2008, 06:44 PM

                Last year I did a Chinese site in Textpattern, the document names show up in Chinese properly. I checked IE but it was not, however, my friend, the site owner, who is using Chinese version XP, told me he can see the document name in Chinese from his IE.
                I just saw a reference to a setting in IE that would allow it to do that; I thought I bookmarked it but did not.

                I’m not worried about evil things being put in the alias; if the client wants it this way that’s his problem. And it is working just fine, so I thought the knowledge of how to get this working with MODx might be useful to others.

                As far as being utf-8, that depends entirely on the database configuration. You can set the MODx charset to whatever you want, and it won’t do much good unless the database is supporting that charset as well.

                http://www.ietf.org/rfc/rfc3987.txt
                http://support.microsoft.com/?kbid=842848
                http://support.microsoft.com/kb/925261
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 30497
                  • 245 Posts
                  Just browsing this thread - I have experimented with Hebrew document aliases and they worked fine in FF. I guess I am missing something here, but, what is the hack for exactly?
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    there is a line to convert all non-ASCII alphanumeric characters and - and _ to a null in the save_content processor. It wouldn’t allow the saving of a Hebrew text alias. I just commented out that line.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 30497
                      • 245 Posts
                      Quote from: sottwell at Jul 05, 2008, 03:00 PM

                      there is a line to convert all non-ASCII alphanumeric characters and - and _ to a null in the save_content processor. It wouldn’t allow the saving of a Hebrew text alias. I just commented out that line.

                      ok, I mustn’t have checked it properly before, for some reason I thought I had tested it when developing my last site, but yes, it doesn’t work without the hack.