You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
shell.openExternal(path) does not work well if there are non-ascii chars in the path #6302
(for someone who gets around to fixing this)
From recently fixing my own code around this; you can get the correct 'wide character' command line using GetCommandLineW() and then you can convert that to utf-8 for internal use. (or javascript string or whatever is required) (even if the startup is just a standard WinMain in non _UNICODE mode is being used you can call GetCommandLineW() ); no need to radically change the build.
Although I was assuming you're opening a file from the command line to launch electron; and it might be that CreateFileW is really where the error is (or wfopen(?) ).
GetCommandLineW seems C/C++ code but I am a javascript guy and no idea what I should do in my code to work around this. please give some some hint what I should do.
The feature I am implementing is we are going to support downloading some files into a local directory and after the download , I will let my user to open that target directory.
thx @zcbenz , yes, openItem works. As openExternal works for ascii path, it would be better support for non-ascii as well that way we can only remember one api.
Activity
d3x0r commentedon Jul 1, 2016
(for someone who gets around to fixing this)
From recently fixing my own code around this; you can get the correct 'wide character' command line using GetCommandLineW() and then you can convert that to utf-8 for internal use. (or javascript string or whatever is required) (even if the startup is just a standard WinMain in non _UNICODE mode is being used you can call GetCommandLineW() ); no need to radically change the build.
Although I was assuming you're opening a file from the command line to launch electron; and it might be that CreateFileW is really where the error is (or wfopen(?) ).
wangxiexe commentedon Jul 1, 2016
GetCommandLineW seems C/C++ code but I am a javascript guy and no idea what I should do in my code to work around this. please give some some hint what I should do.
The feature I am implementing is we are going to support downloading some files into a local directory and after the download , I will let my user to open that target directory.
thx.
zcbenz commentedon Jul 1, 2016
If you want to open file you should usually use
openItem, which works with Unicode characters.wangxiexe commentedon Jul 3, 2016
thx @zcbenz , yes, openItem works. As openExternal works for ascii path, it would be better support for non-ascii as well that way we can only remember one api.
Use the more specific shell.openPath() on Windows (#10040)
Use the more specific shell.openPath() on Windows (#10040)