1.1 --- a/tools/get_profile.py Sat Nov 02 01:48:34 2013 +0100
1.2 +++ b/tools/get_profile.py Sat Nov 02 19:03:37 2013 +0100
1.3 @@ -9,11 +9,11 @@
1.4
1.5 from os.path import split
1.6 from urllib import basejoin
1.7 -import libxml2dom, sys
1.8 +import libxml2dom, sys, codecs
1.9
1.10 def get_profile(url, username):
1.11 try:
1.12 - d = libxml2dom.parseURI("%s/display/~%s" % (url.rstrip("/"), username), html=True)
1.13 + d = libxml2dom.parseURI("%s/display/~%s" % (url.rstrip("/"), username), html=True, htmlencoding="utf-8")
1.14
1.15 fullname = d.xpath("//span[@id='fullName']")
1.16 fullname = fullname and fullname[0].textContent or ""
1.17 @@ -39,8 +39,9 @@
1.18 print >>sys.stderr, "Example: %s http://wiki.list.org/ <username>" % progname
1.19 sys.exit(1)
1.20
1.21 + stdout = codecs.getwriter("utf-8")(sys.stdout)
1.22 details = get_profile(url, username)
1.23 - print "\t".join(details)
1.24 + print >>stdout, "\t".join(details)
1.25
1.26 if __name__ == "__main__":
1.27 main()