Skip to content

Commit

Permalink
add UTF-8 support for Client7z (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
flyfishzy authored Feb 6, 2023
1 parent 295dac8 commit d5fa760
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CPP/7zip/UI/Client7z/Client7z.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
HINSTANCE g_hInstance = 0;
#endif

#ifdef ENV_HAVE_LOCALE
#include <locale.h>
#endif

// Tou can find the list of all GUIDs in Guid.txt file.
// use another CLSIDs, if you want to support other formats (zip, rar, ...).
// {23170F69-40C1-278A-1000-000110070000}
Expand Down Expand Up @@ -718,6 +722,8 @@ STDMETHODIMP CArchiveUpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDef

// Main function

extern int global_use_utf16_conversion;

#define NT_CHECK_FAIL_ACTION PrintError("Unsupported Windows version"); return 1;

int MY_CDECL main(int numArgs, const char *args[])
Expand All @@ -732,6 +738,12 @@ int MY_CDECL main(int numArgs, const char *args[])
return 1;
}

#ifdef ENV_HAVE_LOCALE
// set the program's current locale from the user's environment variables
setlocale(LC_ALL,"");
global_use_utf16_conversion = 1;
#endif

NDLL::CLibrary lib;
if (!lib.Load(NDLL::GetModuleDirPrefix() + FTEXT(kDllName)))
{
Expand Down

0 comments on commit d5fa760

Please sign in to comment.