Merge pull request #5 from jwilk-forks/encoding
Decode article name with locale encoding
This commit is contained in:
commit
fa546f7b6a
|
@ -9,6 +9,7 @@ import urlparse
|
||||||
import os, locale, time
|
import os, locale, time
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
|
|
||||||
|
locale_encoding = locale.getpreferredencoding()
|
||||||
lang = locale.getdefaultlocale()[0].split('_')[0] or ''
|
lang = locale.getdefaultlocale()[0].split('_')[0] or ''
|
||||||
|
|
||||||
def sanitize(s):
|
def sanitize(s):
|
||||||
|
@ -66,7 +67,7 @@ def main():
|
||||||
print('Connected to %s://%s%s' % (scheme, host, path), file=stderr)
|
print('Connected to %s://%s%s' % (scheme, host, path), file=stderr)
|
||||||
|
|
||||||
# Find the page
|
# Find the page
|
||||||
page = site.pages[args.article_name]
|
page = site.pages[args.article_name.decode(locale_encoding)]
|
||||||
if not page.exists:
|
if not page.exists:
|
||||||
p.error('Page %s does not exist' % args.article_name)
|
p.error('Page %s does not exist' % args.article_name)
|
||||||
fn = sanitize(args.article_name)
|
fn = sanitize(args.article_name)
|
||||||
|
|
Loading…
Reference in New Issue