News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

CreatePost 'htmlspecialchars' because it no longer works just like SMF 2.0

Started by Dhayzon, April 12, 2022, 06:38:21 PM

Previous topic - Next topic

Dhayzon


I used to use in SMF 2.0, works fine

$body = '𝘁𝗲𝘄';
$body = $smcFunc['htmlspecialchars']($body); 
$msgOptions = array( 
            'body' => $body,
            );

createPost($msgOptions, $topicOptions, $posterOptions); 

but in SMF 2.1.1 no longer works, now I returned this

𝘁𝗲𝘄



Arantor

It's working as intended.

Entity 120321 is Unicode 1D601, which is a 4 byte character. The *only* way this goes into a utf8_general_ci table is in Unicode encoding.

If you manually modified your database to be utf8mb4 it won't natively be supported by SMF.

The conversion of 4-byte UTF-8 characters to entity form was introduced in 2.0.10 - I wrote the code for it. The 2.1 behaviour is not new - if it is 'new' that means you weren't encoding the data correctly before inserting it.
Holder of controversial views, all of which my own.


Dhayzon


Advertisement: