iOS Question Spaces in file names when opening external files

Discussion in 'iOS Questions' started by JustinLong, May 16, 2018 at 3:45 AM.

Similar threads

B4i Tutorial Open external files with your app
B4A Tutorial [B4X] Anchors Demonstrated
B4i Tutorial Custom Fonts
B4i Library TabStrip
B4J Tutorial [B4X] External Editors
  1. JustinLong

    JustinLong Member Licensed User

    I'm using the code posted here: https://www.b4x.com/android/forum/threads/open-external-files-with-your-app.50525/

    which is working very well, except when the file being imported has a space in the name.

    For example, MyFile.csv imports without issue, however "My File.csv" throws the error: "The file "My%20File.csv" could not be opened because there is no such file."

    Since B4i already seems to be replacing the space with %20, I'm at a loss for how to fix this.

    Thanks in advance,
    Justin
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    What is the output of Log(url)?
     
  3. JustinLong

    JustinLong Member Licensed User

    file:///private/var/mobile/Containers/Data/Application/908F61FB-1794-4029-BC60-E776EF610EC0/Documents/Inbox/My%20File.csv
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Add:
    Code:
    f = f.Replace("%20"" ")
     
  5. JustinLong

    JustinLong Member Licensed User

    Worked perfectly. I hate it when the fix is something obvious...

    Many thanks on the great product and helpful support-
     
Loading...