The function tidy_parse_string
change my locale to 'C'.
<?php
setlocale(LC_ALL, 'de_DE');
/* [...] */
echo setlocale(LC_ALL, 0); // Show "de_DE"
$tidy = tidy_parse_string($text, $config, 'UTF8');
echo setlocale(LC_ALL, 0); // show "C" instead of "de_DE"
?>
There is an option to prevent it?
There is nothing about it in the PHP and Tidy documentation.
I know I can simply re-change my locale after tidy function with
<?php
setlocale(LC_ALL, 'de_DE');
/* [...] */
$oldLocale = setlocale(LC_ALL, 0);
$tidy = tidy_parse_string($text, $config, 'UTF8');
setlocale(LC_ALL, $oldLocale);
?>
but I want to know if this is a feature, a bug or something else.
Thanks
It's a bug: https://github.com/htacg/tidy-html5/issues/770.
So the workaround is to insert the setlocale after the call.
<?php
setlocale(LC_ALL, 'de_DE');
/* [...] */
$oldLocale = setlocale(LC_ALL, 0);
$tidy = tidy_parse_string($text, $config, 'UTF8');
setlocale(LC_ALL, $oldLocale);
?>