We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36416
    • 589 Posts
    Quote from: Joss at Jun 28, 2009, 06:44 PM

    Unfortunately it non supporting UTF-8 encoding.

    In what way - subject parameter or something else...?
      • 14806
      • 72 Posts
      Example of broken code:

      <a href="mailto:[email protected]">адрес электронной почты</a>

      or in English (it’ll works fine):

      <a href="mailto:[email protected]">email address</a>

      And on the page in browser, the string "email address" (of course, in russian UTF-8 encoding - "адрес электронной почты", english string is only as example) - looks like "адрес электронной почты"

      Thanks!
        • 18174
        • 116 Posts
        Since I had probs with utf-8 content to set a mailto: link with subject, I made a small modification to cure this:
        ~line 132:
        ....  if ( sizeof($matches) < 3 ) {
            // Link without a linktext: insert email address as text part
            $matches[2] = $matches[1];
          }
          
          // urlencode a possible subject  EM+  1 LINE ADDED  
          $matches[1] = preg_replace('!(.*\?(subject|body)=)([^\?]*)!ie',"'$1'.rawurlencode('$3')",$matches[1]);
        
          // Create html of the true link
          $trueLink = "<a class=\"emo_address\" href=\"mailto:" . $matches[1] . ......

        hope this helps

        EDIT:
        I enlarged the code a bit to serve also the ?body= expression.
        The fix above would provide both ?subject and ?body expression. They don’t work together in my mail client. But this is another problem.
        regards
        manu
          • 5112
          • 38 Posts
          manu’s mods looks great, but i am unclear as to how to specify what i want in the configuration tab.

          this makes no sense to me:
          &emoTplOnly=Templates only?;list;enable,disable;enable &emoSelection=How to select ID’s?;list;exclude,include;exclude &emoSelectionRange=Chosen ID’s;text;

          can someone post some examples of how they specified particular document ids and templates?

          thanks.
            • 10076
            • 1,024 Posts
            Hi,

            wel if you add that code in the plugin config tab, you get the choice to include or exclude pages.
            You fill that in the field choosen ID. See attachement, in that situation I choose to exclude pages that the ID is filled in in the chosen ID field. Works fine,

            best fr
              • 5112
              • 38 Posts
              @Frank

              thanks for posting. i could not figure out where the ids went, but your jpg helped me see. i guess i should have pasted in the code first and then updated parameter display.

              clear now. and working well. thanks again.
                • 36451
                • 264 Posts
                Is this plugin working with 1.02?
                  • 13428 ☆ A M B ☆
                  • 1,031 Posts
                  Quote from: Joss at Jun 29, 2009, 05:08 AM

                  <a href="mailto:[email protected]">адрес электронной почты</a>
                  And on the page in browser, the string "адрес электронной почты" looks like "адрес электронной почты"
                  Maybe you could add a ’u’ to the regex.

                  $modx->documentOutput = preg_replace_callback("#<a[^>]*mailto:([^’\"]+)[’\"][^>]*>([^<]*)</a>#iu", "encodeLink", $modx->documentOutput);
                    • 18174
                    • 116 Posts
                    As Joss mentions there are still problems with UTF-8. I learn that the if text surrounded by a <a href="mailto:...> tag has extexted characters like "Jürg", the calculated output is misspelled. I suppose that base64 encoding/decoding isn’t suited for extended charsets like UTF-8. In this case as I want to leave the editor store as raw data, I would write "Juerg" as a workaround.
                    regards
                    manu
                      • 26931
                      • 2,314 Posts
                      Quick fix:
                      wrap email address pattern search like this
                      Code:
                      if (!isset($_POST[’submit’])) { //Eol: skip submitted pages
                      $modx->documentOutput = preg_replace_callback("#<a[^>]*mailto:([^’\"]+)[’\"][^>]*>([^<]*)</a>#i", "encodeLink", $modx->documentOutput);
                      $modx->documentOutput = preg_replace_callback(email_regex(), "encodeLink", $modx->documentOutput);
                      }
                      Hi Eol (and everyone else of course), where do i have to place this? thanks, j