Skip to content

Commit 0f03f4c

Browse files
hlyunbug
authored andcommitted
修复URL中文编码问题 (unbug#43)
1 parent 5646b63 commit 0f03f4c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎Mdnsearch.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@
99
import subprocess
1010
import webbrowser
1111

12+
try:
13+
# python2
14+
from urllib import quote
15+
except ImportError:
16+
# python3
17+
from urllib.parse import quote
18+
1219

1320
def SearchFor(text):
14-
url = 'http://unbug.github.io/codelf/#' + text.replace(' ', '%20')
21+
url = 'http://unbug.github.io/codelf/#' + quote(text)
1522
webbrowser.open_new_tab(url)
1623

1724

@@ -40,4 +47,3 @@ def run(self, edit):
4047

4148
text = self.view.substr(selection)
4249
SearchFor(text)
43-

0 commit comments

Comments
 (0)