Skip to content

PDF (and xlsx/ods) files cannot be opened from Files pane when their filenames/paths include non-ASCII characters #12467

Closed

Description

@k1-ito

System details

RStudio Edition : Desktop
RStudio Version : 2022.12.0-353 (Elsbeth Geranium)
OS Version      : Windows 10/11 Pro 22H2
R Version       : 4.2.2

Steps to reproduce the problem

  1. Update Rstudio Desktop from 2022.07.2-576 (Spotted Wakerobin) to 2022.12.0-353.
  2. In Files pane of RStudio, move to a folder where a PDF file is.
  3. Click the PDF file in Files pane.

Describe the problem in detail

When its filename or path includes non-ASCII character(s), the default PDF viewer does not launch and the PDF file is not opened.
In the case below, only London.pdf can be opened by clicking it.
(In contrast, any Rmd file is properly shown in Source pane.)
Files

Describe the behavior you expected

Regardless of its filename or path, a PDF file is opened by clicking it in Files pane.

Additional information

  • Under the identical conditions mentioned above (non-ASCII characters are included in the filename or path),
    • when clicking an xlsx file and selecting View File in Files pane, Excel does not launch and the file is not opened.
    • when clicking an ods file in Files pane, LibreOffice Calc does not launch and the file is not opened.
  • In the previous version 2022.07.2-576 (Spotted Wakerobin), all of these files (PDF/xlsx/ods) are opened as expected.
  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity

  1. added
    new
    on Dec 20, 2022
  2. changed the title [-]PDF (and xlsx/ods) files cannot be opened from Files pane uncer certain conditions[/-] [+]PDF (and xlsx/ods) files cannot be opened from Files pane under certain conditions[/+] on Dec 20, 2022
  3. added
    locale
    and removed
    new
    on Dec 20, 2022
  4. ronblum commented on Dec 20, 2022

    @ronblum
    Contributor

    @k1-ito Thank you for raising this! We've run into issues with non-ASCII characters in the past. In this case, do the .Rmd file open, or do they fail to open, as well?

  5. added
    info needed
    on Dec 20, 2022
  6. k1-ito commented on Dec 20, 2022

    @k1-ito
    Author

    @ronblum Thank you for your response. I can open all the four Rmd files in the example above by clicking them in Files pane. (London.Rmd, München.Rmd, SãoPaulo.Rmd, 東京.Rmd)
    The contents are shown in Source pane with no problem.

  7. changed the title [-]PDF (and xlsx/ods) files cannot be opened from Files pane under certain conditions[/-] [+]PDF (and xlsx/ods) files cannot be opened from Files pane when their filenames/paths include non-ASCII characters[/+] on Feb 9, 2023
  8. k1-ito commented on Mar 17, 2023

    @k1-ito
    Author

    The situation looks the same in RStudio-2023.03.0+386.

  9. k1-ito commented on Apr 22, 2023

    @k1-ito
    Author

    @ronblum I have updated R to 4.3.0. The situation looks the same.

    Additional information

    Fonts of Japanese characters are sans-serif in 2022.07.2+576 and the earlier versions, while they are serif in 2022.12.0+353 and the later ones.

    RStudio-2022.07.2+576 (sans-serif)
    スクリーンショット 2023-04-22 155520

    RStudio-2023.03.0+386 (serif)
    スクリーンショット 2023-04-22 155240

  10. k1-ito commented on Apr 23, 2023

    @k1-ito
    Author

    I've found that the electron version of 2022.07.2+576 has the same problems as 2022.12.0+353 and the later ones (the Qt version of 2022.07.2+576 works fine).

  11. gtritchie commented on Apr 23, 2023

    @gtritchie
    Member

    Yes, this is a path handling bug in RStudio (Electron) so any version 2022.12 or newer has this problem. Should be an easy fix, I'll take a look.

  12. self-assigned this
    on Apr 23, 2023
  13. 16 remaining items

  14. k1-ito commented on Nov 8, 2023

    @k1-ito
    Author

    Unfortunately, under my environment, it seems the problems remain. The files in question do not open.

    Rstudio: 2023.12.0-dayly+262
    R: 4.3.2 "Eye Holes"
    Windows: 11 Pro 22H2 build 22621.2428

    I tried both the installer-less and the exe versions of the daily build.

  15. jonvanausdeln commented on Nov 8, 2023

    @jonvanausdeln

    @k1-ito , what filename is failing for you?

  16. self-assigned this
    on Nov 8, 2023
  17. k1-ito commented on Nov 8, 2023

    @k1-ito
    Author

    The filenames include:
    München.pdf, SãoPaulo.pdf, 東京.pdf, München.xlsx, SãoPaulo.xlsx, 東京.xlsx.

  18. kevinushey commented on Nov 8, 2023

    @kevinushey
    Collaborator

    It does work for me... here's the command I used to test:

    pdf("hello.pdf")
    plot(1)
    dev.off()
    file.rename("hello.pdf", "東京.pdf")
    

    Then, try to open the PDF from the files pane.

    Note that the workaround we added requires short path names to be enabled on the filesystem. @k1-ito, can you share the output of:

    shortPathName("東京.pdf")
    

    In this scenario, I see:

    > shortPathName("東京.pdf")
    [1] "7CA8~1.PDF"
    

    In addition, you could also check from a Windows Command Prompt (need to start as administrator)

    C:\Windows\System32>fsutil 8dot3name query C:
    The volume state is: 0 (8dot3 name creation is ENABLED)
    The registry state is: 2 (Per volume setting - the default)
    
    Based on the above settings, 8dot3 name creation is ENABLED on "C:"
    

    Replace C: with the drive that your PDFs are on.

  19. k1-ito commented on Nov 9, 2023

    @k1-ito
    Author

    Thank you for your explanation.
    The files were saved in a drive in which the 8.3 filename creation is disabled.

    I tried your command in the C drive, where the 8.3 filename creation is enabled.
    But again, 東京.pdf did not open.

    I also tried to open other files.
    The result is:
    success München.xlsx SãoPaulo.xlsx
    fail München.pdf SãoPaulo.pdf 東京.pdf 東京.xlsx

    With regard to the short filename, I have found that the 8.3 rule in my environment seems different from yours, and that all the "failed" files have short filenames with non-ASCII characters.
    daily

  20. kevinushey commented on Nov 9, 2023

    @kevinushey
    Collaborator

    Thank you, that is very interesting -- perhaps it depends on the default system language or locale?

    To resolve this, we would likely need to implement our own file opening utility, since we're effectively working around a bug in Electron itself. We'll try to see if there's some straightforward way to accomplish this.

  21. kevinushey commented on Nov 17, 2023

    @kevinushey
    Collaborator

    I think this may have also been resolved by #13926.

  22. jonvanausdeln commented on Nov 17, 2023

    @jonvanausdeln

    @k1-ito , can you try with our latest daily build ? 2023.12.0-daily+306
    I was able to open the files without issue.

  23. k1-ito commented on Nov 17, 2023

    @k1-ito
    Author

    Thank you so much! I could also open the files with this build.

  24. kevinushey commented on Nov 18, 2023

    @kevinushey
    Collaborator

    Great! Thanks for taking the time to confirm.

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

Metadata

Metadata

Assignees

Labels

bugelectronfiles panelocaleregression

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions