Menu

#10 URL containing white spaces are not opened on Mac

pending
nobody
None
5
2011-09-19
2011-09-07
Tiberiu
No

Hi,

As mentioned by several users both on the Forum and into the Tracker it seems that files/URLs that contain empty spaces in their full path do not open on MAC OS platforms. It there a solution for this?

Tibi

Discussion

  • Tiberiu

    Tiberiu - 2011-09-19

    It seems that the problem comes from Mac platform and not from BrowserLauncher2 library. We need to replace spaces with %20 for the file URL otherwise the Mac doesn't like to open it. We can't just use URLEncoder, since that turns slashes into %2F characters, which is no good.

    The following code should be however integrated into BrowserLauncher2 so that developers do not be forced to use it each time they need to open an URL. Here is the code (I hope someone is willing to add it in BrowserLauncher2...):

    if (url.indexOf(' ') != -1) {
    StringBuffer sb = new StringBuffer();
    char c[] = url.toCharArray();
    for (int i = 0; i < c.length; i++) {
    if (c[i] == ' ') {
    sb.append("%20");
    } else {
    sb.append(c[i]);
    }
    }
    url = sb.toString();
    }

    Thanks,
    Tibi

     
  • Tiberiu

    Tiberiu - 2011-09-19
    • status: open --> pending
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.