Search code examples
phpzend-framework2htmlpurifier

Prevent htmlpurifier from removing umlauts


I've been trying to get German charactes out of HtmlPurifier but without success. The whole scheme is based on UTF-8 so there shouldn't be a problem... and yet there is. Umlauts for example just dissapear. Is there something that I need to set in Htmlpurifier for foreign characters to work properly? I'm not trying to do cyrilic or japanese etc... but support for German, Spanish, Dutch etc would be what I'm after.

Thank for any help.


Solution

  • You could post some of your code and this could be a better answer but for now try:

    $htmlPurifierConfig = HTMLPurifier_Config::createDefault(); 
    $htmlPurifierConfig->set('Core', 'Encoding', 'ISO-8859-1');
    

    You could also store the character code in the string and it should work too

    ä, ü, ö
    

    these may also need to be added to the HTML.Allowed array