Skip to content

Function for opening default browser with a given URL #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2011

Conversation

jmdavis
Copy link
Member

@jmdavis jmdavis commented Jul 22, 2011

Okay. This pull request is on Walter's behalf. I reverted the original commits and created this pull request as discussed. It was suggested that it was better to put the function in std.process instead of its own module, so that's what I did. The only changes that I made were to remove some imports that std.process was already importing and fully give the full module path for getenv and and execvp, since Walter used the C versions rather than those in std.process. Personally, I think that the code should be changed to use the std.process ones instead, but I didn't make any such functional changes prior to creating the pull request, since it's not my code, and it should probably be reviewed as Walter created it (which may very well in it getting changed as I suggested).

@dnadlinger
Copy link
Member

Here is the original commit, including the related discussion: 8fef7af

import core.sys.windows.windows;

extern (Windows)
HINSTANCE ShellExecuteA(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can ShellExecuteA really handle UTF-8 arguments? Why not use ShellExecuteW?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for opening websites, websites addresses don't come in UTF8 as far as I know? Or has this changed? I'm completely out of the loop when it comes to internet rules. RDMD uses it for:

ShellExecuteA(null, "open", "http://www.digitalmars.com/d/2.0/rdmd.html", null, null, SW_SHOWNORMAL);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of now, there are domain names in the native language, though I dunno what kind of unicode they are supposed to use.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blackwhale You are probably referring to Punycode – but I don't know off-hand if it would happen before ShellExecute or if it would have to be manually applied beforehand (I suspect the latter, but that's a pure guess).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look at this: http://stackoverflow.com/questions/155892/unicode-url-decoding

It looks like the truly correct way to handle this is to take unicode and then encode the non-ASCII characters per the standard. And that goes for all OSes.

Regardless, I believe that the general rule with regards to the Windows functions is that the W version should be used (perhaps with a fallback to the A version on older Windows systems). We really shouldn't be using the A versions.

@jmdavis
Copy link
Member Author

jmdavis commented Aug 14, 2011

Okay. The real question here is who is going to do the work on this? It's Walter's code, but it's my pull request. he hasn't had anything to say about it or about the feedback on the pull request. Should I just go ahead and alter it as I see best based on the feedback here?

@andralex
Copy link
Member

Yah, sorry for making it look like you've been framed :o). Let me merge this as is and we'll leave the task up for grabs.

andralex added a commit that referenced this pull request Aug 14, 2011
Function for opening default browser with a given URL
@andralex andralex merged commit 3817bf6 into dlang:master Aug 14, 2011
@braddr
Copy link
Member

braddr commented Aug 14, 2011

Task up for grabs that's hidden off in a closed pull request. Yeah, never gonna happen. If you feel they're important, do them now or file a bug report so at least there's a chance of being found.

@andralex
Copy link
Member

It will happen, as Phobos modules are under constant scrutiny. I know I do make a pass once in a while.

@jmdavis
Copy link
Member Author

jmdavis commented Aug 14, 2011

I think that it would have been better to just ask me to deal with it or have someone else pull in the changes from my repo, do whatever fixes are necessary and then either create a new pull request or ask me to pull them to fix this pull request. Yes, Phobos is under constant scrutiny, but stuff still falls by the wayside. As it is, this risks not getting fixed before the next release, and we release code which we haven't fixed when we have feedback with regards to what about it should be fixed.

http://d.puremagic.com/issues/show_bug.cgi?id=6496

kuettler pushed a commit to kuettler/phobos that referenced this pull request Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants