Skip to content

Conversation

@kellemar
Copy link

Description
Added os_strftime_utf8() to handle strftime correctly on Windows. The existing strftime() calls in os_generate_formatted_filename() now use this new function.

On Windows, strftime() returns strings in the system's ANSI codepage rather than UTF-8. The new function uses wcsftime() and converts to UTF-8 properly.

Motivation and Context
Fixes #12953

Using %Z (timezone name) in the filename format crashes OBS on German Windows because the timezone "Mitteleuropäische Zeit" contains an umlaut. The ANSI-encoded string gets passed to os_fopen() which expects UTF-8, causing MultiByteToWideChar to fail.

Same issue would happen with any locale that has non-ASCII characters in timezone names or other strftime output.

How Has This Been Tested?
I don't have a German Windows installation to test directly. The fix follows the same pattern OBS already uses elsewhere for Windows string handling (wcs functions + os_wcs_to_utf8).

Would appreciate if someone with a German Windows setup could verify.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

@Dankirk
Copy link

Dankirk commented Dec 28, 2025

I have looked into locales and character encodings a bit and have a pull request here #12624 that also fixes this. I can confirm the crash does happen on Windows with settings set to German and that this PR would also fix that.

The timezone name is a bit interesting though, since with our current OBS locale being minimal 'C' on Windows (and not the system locale), the %Z flag is still translated using the Windows display language. This only happens with %Z flag, for example %A (weekday name) properly follows locale settings ('C') and thus is always in English, even on German display language, locale and region.

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.

OBS crashes if filename contains german Umlaut

2 participants