Skip to content

[Bug]: shell.openExternal can't open a windows directory which contains chinese charactors #31347

Closed as not planned

Description

@hayword-wang

Preflight Checklist

Electron Version

15.1.0

What operating system are you using?

Windows

Operating System Version

Windows 10 1803 Version 2019.05.28

What arch are you using?

x64

Last Known Working Electron version

15.1.0

Expected Behavior

shell.openExternal open the directory 'D:/测试'

Actual Behavior

shell.openExternal('D:/测试')
Uncaught (in promise) Error: Failed to open

Testcase Gist URL

No response

Additional Information

No response

Activity

  1. noobakong commented on Oct 9, 2021

    @noobakong

    i get the same problem, and use child_process.execFileSync can work

    ("electron": "13.1.7")

  2. hayword-wang commented on Oct 11, 2021

    @hayword-wang
    Author

    i get the same problem, and use child_process.execFileSync can work

    ("electron": "13.1.7")

    Excetly, but looking forward to electron official support. Time to turn on the folder with explorer.exe to spend more than 3 seconds, and need manual support cross-platform.

  3. FarbrorGarbo commented on Oct 22, 2021

    @FarbrorGarbo

    Having the same problem with common Swedish characters å, ä ö etc. in file names or paths. Made a BIG jump from electron version 1.7.8 where it worked.

  4. terry2010 commented on Jan 24, 2022

    @terry2010

    maybe it's your encoding error? your js file is UTF-8 encoding , chinese windows system is ANSI, you could chang your file name to gbk to fix this problem

    var iconv = require("iconv-lite"); var str='D:/测试'; var rawStr = iconv.encode(str, 'gbk').toString('binary'); shell.openExternal(rawStr )

  5. xxxace commented on Sep 6, 2022

    @xxxace

    hi! i do the same things as your reply but it don't works

    rawStr is D:/²âÊÔ

    image

    let rawStr = iconv.encode('D:/测试', 'gbk').toString('binary');
    console.log(rawStr)
    shell.openExternal(rawStr)
    

    electron version: 20.0.2

  6. terry2010 commented on Sep 6, 2022

    @terry2010

    hi! i do the same things as your reply but it don't works

    rawStr is D:/²âÊÔ

    image

    let rawStr = iconv.encode('D:/测试', 'gbk').toString('binary');
    console.log(rawStr)
    shell.openExternal(rawStr)
    

    electron version: 20.0.2

    there is many character encodings could show chinese charact, eg. gbk , big5 &etc , some psychos even use windows-31J

    so.maybe you should try more encoding

  7. github-actions commented on Jan 10, 2023

    @github-actions
    Contributor

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  8. wh201906 commented on Jan 28, 2023

    @wh201906

    Even the encoded url doesn't work.

    For example, if I type file:///E:/%E6%B5%8B%E8%AF%95/test.txt in the address bar of Firefox then hit Enter, it can load the file.
    图片

    but when I run require('electron').shell.openExternal("file:///E:/%E6%B5%8B%E8%AF%95/test.txt"), it reports a error
    图片

  9. github-actions commented on Apr 30, 2023

    @github-actions
    Contributor

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  10. 5 remaining items

  11. electron-issue-triage commented on Oct 31, 2023

    @electron-issue-triage

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  12. wh201906 commented on Oct 31, 2023

    @wh201906

    bump

  13. electron-issue-triage commented on Jan 31, 2024

    @electron-issue-triage

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  14. wh201906 commented on Jan 31, 2024

    @wh201906

    bump

  15. electron-issue-triage commented on May 1, 2024

    @electron-issue-triage

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  16. electron-issue-triage commented on Jun 1, 2024

    @electron-issue-triage

    This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions