[wp-meta] [Making WordPress.org] #1297: Disappearing topic titles on Rosetta forums
Making WordPress.org
noreply at wordpress.org
Mon Nov 23 14:57:32 UTC 2015
#1297: Disappearing topic titles on Rosetta forums
-----------------------------+----------------------------------
Reporter: SergeyBiryukov | Owner:
Type: defect | Status: new
Priority: normal | Component: International Forums
Resolution: | Keywords:
-----------------------------+----------------------------------
Comment (by SergeyBiryukov):
@netweb pointed out that `_fix_badly_utf8_trimmed_string.php` is the most
likely cause:
{{{
function fix_badly_utf8_trimmed_string( $string ) {
return iconv( 'utf-8', 'utf-8//ignore', $string );
}
add_filter( 'topic_title', 'fix_badly_utf8_trimmed_string', 9 );
add_filter( 'term_name', 'fix_badly_utf8_trimmed_string', 9 );
}}}
via https://php.net/manual/en/function.iconv.php#108643:
> The `//ignore` option doesn't work with recent versions of the iconv
library. So if you're having trouble with that option, you aren't alone.
>
> That means you can't currently use this function to filter invalid
characters. Instead it silently fails and '''returns an empty string'''
(or you'll get a notice but only if you have E_NOTICE enabled).
I've tested it with a broken string (`Как вернуться на 4.2, как запретить
автоматическое обно�`), and it does return an empty string on my install
(PHP 5.4.45, iconv 1.14).
`mb_convert_encoding()` handles this correctly:
{{{
function fix_badly_utf8_trimmed_string( $string ) {
ini_set( 'mbstring.substitute_character', 'none' );
return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' );
}
}}}
--
Ticket URL: <https://meta.trac.wordpress.org/ticket/1297#comment:11>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org
More information about the wp-meta
mailing list