Skip to content

[2.1] Fix upgrader charset_detected lookup - #9895

Merged
jdarwood007 merged 1 commit into
SimpleMachines:release-2.1from
sbulen:21_fix_lang_charset_lookup
Nov 16, 2026
Merged

jdarwood007 merged 1 commit into
SimpleMachines:release-2.1from
sbulen:21_fix_lang_charset_lookup

Conversation

@sbulen

@sbulen sbulen commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Last remaining fix for #9786

That logic is trying to make sure that you can do lookups in both $charsets and $lang_charsets based on the forum's primary language from Settings.php, $language. If found, it sets charset_detected.

It shouldn't be using charset_detected AS AN INPUT, because it's not set yet... It shouldn't be using lang_character_set either, because in 2.1 that will always be 'UTF-8', and will never tell us where we're moving FROM.

It's a two-level lookup... $lang_charsets translate from $language to encodings... $charsets translates from encodings to MySQL charsets. Ultimately we need the MySQL charset for the conversion. The intent of this was to make sure both lookups exist before setting charset_detected.

NOTE: There is no equivalent 3.0 fix yet, as the ability to upgrade from older versions of SMF hasn't been implemented. See #9120.

Test - Before this fix, a Ukrainian language lookup fails & the charset falls back to ISO-8859-1 & latin1, which is incorrect, resulting in mangled data:

ukr_before_lookup_fix

Test - After this fix, the same Ukrainian language lookup properly finds Windows-1251 & cp1251:

ukr_after_lookup_fix

Signed-off-by: Shawn Bulen <bulens@pacbell.net>
@sbulen

sbulen commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

I believe this addresses #8125 as well.

@jdarwood007
jdarwood007 merged commit d6334e8 into SimpleMachines:release-2.1 Nov 16, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants