We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5134
    • 3 Posts
    Hi all,

    first post for me...
    Searching the forum didn’t bring any results, so i’ll try and just ask. smiley
    I have a some trouble with the WebSignUp Snippet.
    I tweaked it a little bit so users can add more information like their company or a website etc. This worked out fine.
    Since it’s a german website, i of course have some problems with those damned "umlaute" (is this actually the correct word in english?)
    Everything i do from the Manager is just fine, the characters save as utf-8 and display as they should on the front-end.
    I even got it working that when someone signs up via the frontend, the data is correctly saved in the db. BUT. laugh
    The email that is sent to the user displays all the umlaute as those cryptic characters (like "ö") and i can’t find the reason.

    I also have a little function included which generates a username from the first 3 letters of the users last name and a random number. Inside this function, i replace all umlaute with "ae", "oe", "ue" and so on. Funny enough, the umlaute are converted to those cryptic characters even before they can be replaced...
    ...help, anyone?
    thanks!
      • 5134
      • 3 Posts
      Solved it myself.
      I convert the lastname-variable to htmlentities before i generate the username:
      $lastname = htmlentities($_POST['lastname'],ENT_QUOTES,'UTF-8');

      In the username-generation-function, i convert the string back with htmlentity_decode():

      function genUserName($lastname)
      {
      	$lastname = html_entity_decode($lastname);
      	$uml = array('/Ä/','/ä/','/Ö/','/ö/','/Ü/','/ü/','/ß/');
      	$repl = array('Ae','ae','Oe','oe','Ue','ue','ss');
      	$lastname = preg_replace($uml,$repl,$lastname);
      	$name = substr($lastname,0,3);
              $suffix = substr(md5(microtime()),-4);
      	$username = $name.$suffix;
              return $username;
      }


      works fine.
      have a nice day! laugh