Skip to content

Conversation

@jordan-woyak
Copy link
Member

@jordan-woyak jordan-woyak commented Jan 28, 2026

Replaces: #14282.
Fixes: https://bugs.dolphin-emu.org/issues/13962

Note that std::wstring_convert throws exceptions on invalid sequences, and it's deprecated, to be removed in C++26.

This PR replaces usage of wstring_convert with hand-rolled UTF8/16 encoding/decoding.

I'd usually rather just use an existing libarary (like iconv) but..

  • The iconv dependency isn't set up in the Windows build.
  • WinAPI's MultiByteToWideChar can't output to a std::u16string without strict aliasing violations or a memcpy.
  • UTF8/16 really isn't overly complicated.
  • These hand-rolled versions seem to be 5-10x faster than iconv in my simple tests.
  • We have more control over how semi-invalid sequences are handled. This issue will be fixed if QString conversion functions are changed to use the custom decoder.

If we wanted to entirely eliminate the iconv dependency, CP1252 would be easy enough to implement, but ShiftJIS looks like it isn't so fun.
Edit: I have these implemented locally if we want to do that. ShiftJIS wasn't so bad.. just some giant tables.

@jordan-woyak jordan-woyak force-pushed the character-encoding branch 3 times, most recently from 620d316 to a7acf88 Compare January 29, 2026 04:31
…ding implementation to eliminate usage of deprecated std::wstring_convert.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant