mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-14 01:27:35 -05:00

A user points out that the new charset-aware window title setting doesn't work if the configured character set is one of the entries in cp_list[] based on a hard-coded Unicode translation table, such as the ISO 8859 family. That's because the Windows mb_to_wc() function assumes that the code page it's given will always be OK to pass to the Windows API function MultiByteToWideChar, forgetting that for those internally implemented single-byte character sets are not. This commit adds a manual implementation of SBCS -> Unicode based on those tables, which restores the ability to set a window title specified in ISO 8859. However, it's not a full fix to windows/unicode.c in general, because wc_to_mb has a similar blind spot: it's only prepared to convert Unicode to an internally implemented SBCS if that SBCS happens to be the one currently set in ucsdata->line_codepage, because that's when we've already prepared the reverse lookup table. Probably we ought to sort that out, and arrange that it can make the reverse lookup table if suddenly called on to do a different conversion. But that needs more refactoring, so I haven't done it in this commit.