tdf#54204 File URLs with fragment need toIUri conversion

Non-ASCII file links didn't work when the link contains anchor at
the end.

Note: The "correct" way to convert from a LO-internal to -external
file URL would be the translateToExternal method of the
css.uri.ExternalUriReferenceTranslator UNO service.  But that
translates the URL to be interpreted according to the current Windows
code page (i.e., osl_getThreadTextEncoding), so only supports
characters covered by that code page, and given that  the result is
passed into a Windows wchar_t API, ToIUri nicely avoids such potential
conversion failure.

Change-Id: I1a5b07366b0fea3da2fbe11a9378aacd765b5e04
Reviewed-on: https://gerrit.libreoffice.org/82219
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index 73ef77b..ccf932e 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -33,6 +33,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
#include <o3tl/runtimetooustring.hxx>
#include <rtl/uri.hxx>

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -431,6 +432,10 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
        OUString aSystemPath;
        if (::osl::FileBase::E_None == ::osl::FileBase::getSystemPathFromFileURL(preprocessed_command, aSystemPath))
            preprocessed_command = aSystemPath;
        else if (preprocessed_command.startsWithIgnoreAsciiCase("file:"))
            //I use ToIUri conversion instead of the translateToExternal method of the css.uri.ExternalUriReferenceTranslator
            //UNO service, because the translateToExternal method only supports characters covered by the current Windows code page.
            preprocessed_command = rtl::Uri::decode(preprocessed_command, rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8);
    }

    SHELLEXECUTEINFOW sei;