We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 727
    • 502 Posts
    Hopefully this is a basic mistake on my part. I am submitting a form using eForm, where one of the POST values contains a Ü (U with umlaut). When I display the posted value on a web page it is fine. When I try to use it in a snippet, it is mangled.

    Here is a snippet I created:

    $log = fopen("/tmp/gdtokenizer.log", "a");
    fwrite($log, "Accessibility (snippet) = ".$_POST['accessibility']."\n");
    return "<p>Accessibility = ".$_POST['accessibility']."</p>";


    On the web page this appears as:

    Accessibility = Öffentlich, drive-in


    However in the log file this appears as an A with tilde:

    Accessibility (snippet) = Ãffentlich, drive-in


    Any ideas?

    Andy
      • 9564
      • 13 Posts
      I think this may occurs if youre DB has another character-set than your website.

      The data found on the log is stored in the database. The string which is correct is printed out directly without saving it to a db.
        • 727
        • 502 Posts
        Thanks for the reply. I’m not using a database, just sumitting a form and printing the result to a text file and the web page. sad

        Andy
          • 9564
          • 13 Posts
          Mmh - I don’t read through the snippet-code. Sorry.

          But you can also use
          string htmlentities ( string string [, int quote_style [, string charset]])

          to transform umlaute to html-entities.

          htmlentities($_POST['accessibility']);
          


          See also: http://www.php.net/htmlentities





          Viel Spaß bei der Arbeit,

          Thomas
            • 727
            • 502 Posts
            The result is that it converts the corrupted string to html entities. Here is what I now see in the log file:

            Accessibility (snippet) = Ãffentlich, drive-in


            :(

            Andy
              • 32942
              • 141 Posts
              You can try my plugin, I hope it fixes your problem. I had the same problem with eForm.
              http://modxcms.com/XHTMLXMLUnicode-1479.html

              Currently The full Unicode 5 charset (>5000 entities) plus all HTML Entities I could find are getting used.
                • 727
                • 502 Posts
                Thanks, I’ll take a look.

                Andy