Skip to content

Fixed incorrect locale saving in Core::vlogLnInternal(). - #656

Merged
ksenonadv merged 1 commit into
openmultiplayer:masterfrom
dev-karpov0:fix-locale
May 16, 2023
Merged

ksenonadv merged 1 commit into
openmultiplayer:masterfrom
dev-karpov0:fix-locale

Conversation

@dev-karpov0

Copy link
Copy Markdown
Contributor

There was a bug in function Core::vlogLnInternal(...) related to incorrect saving of the locale when utf8=true. It led to incorrect text output to the console after calling this function.

Reason: std::setlocale(), if success, returns a pointer to a new locale, not an old.

To recreate a bug:

  1. print some string from script using non-latin symbols e.g. Cyrillic (cp1251)
  2. Do something that make Core::vlogLnInternal(.utf8=true) call. (e.g. Input invalid command into console)
  3. Print string again

@CLAassistant

CLAassistant commented May 15, 2023 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ksenonadv
ksenonadv merged commit 03868d4 into openmultiplayer:master May 16, 2023
@dev-karpov0
dev-karpov0 deleted the fix-locale branch May 16, 2023 09:47
@Hual

Hual commented May 16, 2023

Copy link
Copy Markdown
Collaborator

This should fix #643 #637 #617 and #583

@Y-Less

Y-Less commented May 18, 2023

Copy link
Copy Markdown
Collaborator

Why was debug level filtering added as well via this?

@dev-karpov0

Copy link
Copy Markdown
Contributor Author

That condition was not added but moved higher (before the _lock_locales() call). Otherwise, if condition were true, _unlock_locales() would not be called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants