[pmwiki-users] HTML entities

Hannes Korte ml at hkorte.com
Thu Oct 12 17:05:38 CDT 2006


Hi Patrick, Hi Stirling,

Patrick R. Michaud wrote:
> This is exactly the question to be answered -- does Hannes
> want non-ASCII characters converted to character entities
> when the page is saved, or to be left alone in the markup
> and converted when the page is output?

I want the non-ASCII characters converted to the entities when the page
is printed, so that you can edit the text more comfortably. Thanks for
your hints, I think that I got it now. This works:

Markup('html_entities', 'fulltext',
  "/(.*?)/ei",
  "convertspecialchars('$1')");

function convertspecialchars($str) {
  $tr = array(
    'Ä' => 'Ä', 'Ö' => 'Ö', 'Ü' => 'Ü',
    'ä' => 'ä', 'ö' => 'Ö', 'ü' => 'ü',
    'ß' => 'ß'
  );
  return strtr($str, $tr);
}

Do I use the Markup function correctly?

Hannes




More information about the pmwiki-users mailing list