diff --git a/src/dos_locale.c b/src/dos_locale.c index 2a38bef5..90f1dd34 100644 --- a/src/dos_locale.c +++ b/src/dos_locale.c @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * DOS keyboard locale setup - * Copyright © 2011-2013 Pete Batard + * Copyright © 2011-2020 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -419,7 +419,8 @@ static cp_list cp_hr_list[] = { { 59829, "Georgian"}, { 60258, "Lat-Azeri"}, { 60853, "Georgian (Alt)"}, - { 62306, "Cyr-Uzbek"} + { 62306, "Cyr-Uzbek"}, + { 65001, "Unicode (UTF-8)" } }; static const char* cp_to_hr(ULONG cp) @@ -961,13 +962,13 @@ static ULONG fd_upgrade_cp(ULONG cp) } } - // Don't bother about setting up the country or multiple codepages BOOL SetDOSLocale(const char* path, BOOL bFreeDOS) { FILE* fd; char filename[MAX_PATH]; ULONG cp; + UINT actual_cp; const char *kb; int kbdrv; const char* egadrv; @@ -985,6 +986,13 @@ BOOL SetDOSLocale(const char* path, BOOL bFreeDOS) // Now get a codepage cp = GetOEMCP(); + if (cp == 65001) { + // GetOEMCP() may return UTF-8 for the codepage (65001), + // in which case we need to find the actual system OEM cp. + if (GetLocaleInfoA(GetUserDefaultUILanguage(), LOCALE_IDEFAULTCODEPAGE | LOCALE_RETURN_NUMBER, + (char*)&actual_cp, sizeof(actual_cp))) + cp = actual_cp; + } egadrv = bFreeDOS?fd_get_ega(cp):ms_get_ega(cp); if (egadrv == NULL) { // We need to use the fallback CP from the keyboard we got above, as 437 is not always available diff --git a/src/rufus.rc b/src/rufus.rc index 389012e2..1bd837d2 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 232, 326 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 3.9.1625" +CAPTION "Rufus 3.9.1626" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -395,8 +395,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,9,1625,0 - PRODUCTVERSION 3,9,1625,0 + FILEVERSION 3,9,1626,0 + PRODUCTVERSION 3,9,1626,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -414,13 +414,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.9.1625" + VALUE "FileVersion", "3.9.1626" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-3.9.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.9.1625" + VALUE "ProductVersion", "3.9.1626" END END BLOCK "VarFileInfo"