Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: vbgamer45 on March 06, 2019, 08:41:18 PM

Title: [2.0] Modify Board Other Character Sets SMF 2.0.15
Post by: vbgamer45 on March 06, 2019, 08:41:18 PM
In certain cases when modifying a board with certain character sets will make the board name disappear and then unable to modify the board since it is blank
Issue Non SMF version of htmlspecialchars was used


Sources\ManageBoards.php(418)
        $context['board']['name'] = htmlspecialchars(strtr($context['board']['name'], array('&' => '&')));
        $context['board']['description'] = htmlspecialchars($context['board']['description']);
Change to
        $context['board']['name'] = $smcFunc['htmlspecialchars'](strtr($context['board']['name'], array('&' => '&')));
        $context['board']['description'] = $smcFunc['htmlspecialchars']($context['board']['description']);
Title: Re: [2.0] Modify Board Other Character Sets SMF 2.0.15
Post by: Arantor on March 07, 2019, 02:31:05 AM
What version of PHP?
Title: Re: [2.0] Modify Board Other Character Sets SMF 2.0.15
Post by: vbgamer45 on March 07, 2019, 08:02:13 AM
I tested on PHP 7.1.x
elkarte was doing this on that line

$context['board']['name'] = htmlspecialchars(strtr($context['board']['name'], array('&' => '&')), ENT_COMPAT, 'UTF-8');
$context['board']['description'] = un_preparsecode($context['board']['description']);
Title: Re: [2.0] Modify Board Other Character Sets SMF 2.0.15
Post by: Arantor on March 07, 2019, 08:34:23 AM
Let me guess, you're not running UTF-8 (the default for htmlspecialchars since 5.4)
Title: Re: [2.0] Modify Board Other Character Sets SMF 2.0.15
Post by: vbgamer45 on March 07, 2019, 08:41:39 AM
Guess not in my php.ini the default is empty it is commented out

; PHP's default character set is set to empty.
; http://php.net/default-charset
;default_charset = "UTF-8"
Title: Re: [2.0] Modify Board Other Character Sets SMF 2.0.15
Post by: Illori on March 07, 2019, 08:42:22 AM
what about your database?
Title: Re: [2.0] Modify Board Other Character Sets SMF 2.0.15
Post by: shawnb61 on November 08, 2019, 07:11:19 PM
Confirmed.  Issue is specifically with 4-byte characters, e.g.: 𣎏 世 咹 水 晶 𦓡 空 𣎏 害 咦

Issue also exists with category names, but at least you can update & fix the categories.  You cannot fix the board names. 

Logged as #75

2.1 works properly.
Title: Re: [2.0] Modify Board Other Character Sets SMF 2.0.15
Post by: Arantor on November 09, 2019, 04:00:23 AM
This is because it doesn't use $smcFunc's version of htmlspecialchars that dos multibyte fixing.
Title: Re: [2.0] Modify Board Other Character Sets SMF 2.0.15
Post by: shawnb61 on November 09, 2019, 06:48:44 AM
Yup.