Nochmal zum Problem mit den Umlauten - Und die Lösung (Technics)

by Sebastian Nast, Thursday, February 02, 2017, 21:04 (2640 days ago) @ Auge

Hier nomal die Antwort von meinem IT-Spezie ... :-)

Nein, die 4 Möglichkeiten aus dem anderen Thread gingen bei dir nicht!
Das hatte ich natürlich alles vorher ausprobiert

Die .htaccess mit den Angaben ist auch noch auf dem Server, das hatte keinerlei Änderung gemacht, und auch die anderen Möglichkeiten über ini_set('default_charset', 'ISO-8859-1'); usw haben eben leider nicht funktioniert, das wäre ja schön gewesen. Daher musste ich es über diesen unschönen Workaround machen

Ich habe die entsprechende .htaccess nun auch in /forum_archiv/ gelegt, und auch hier geht es nicht, auch die anderen Lösungen werden dort nicht klappen. Und hier stehen auch ein paar Sachen darüber, das man es eben nicht global setzen kann

http://php.net/manual/de/function.htmlspecialchars.php

As of PHP 5.4 they changed default encoding from "ISO-8859-1" to "UTF-8". So if you get null from htmlspecialchars or htmlentities

Unfortunately, as far as I can tell, the PHP devs did not provide ANY way to set the default encoding used by htmlspecialchars() or htmlentities(), even though they changed the default encoding in PHP 5.4 (*golf clap for PHP devs*). To save someone the time of trying it, this does not work:

<?php
ini_set('default_charset', $charset); // doesn't work.
?>

Unfortunately, the only way to not have to explicitly provide the second and third parameter every single time this function is called (which gets extremely tedious) is to write your own function as a wrapper:

Also das Problem, welches durch diese Änderungen aus dem Thread behoben werden kann, ist wie es ausssieht ein anderes Problem als das, welches bei deinem Forum die Probleme machte

Gruß
Sebastian


Complete thread:

 RSS Feed of thread