News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

[2.0] Modify Board Other Character Sets SMF 2.0.15

Started by vbgamer45, March 06, 2019, 08:41:18 PM

Previous topic - Next topic

vbgamer45

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']);
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Arantor

Holder of controversial views, all of which my own.


vbgamer45

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']);
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Arantor

Let me guess, you're not running UTF-8 (the default for htmlspecialchars since 5.4)
Holder of controversial views, all of which my own.


vbgamer45

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"
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Illori


shawnb61

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.
A question worth asking is born in experience & driven by necessity. - Fripp

Arantor

This is because it doesn't use $smcFunc's version of htmlspecialchars that dos multibyte fixing.
Holder of controversial views, all of which my own.


shawnb61

A question worth asking is born in experience & driven by necessity. - Fripp

Advertisement: