Skip to content

Instantly share code, notes, and snippets.

@jonjensen
Created May 12, 2015 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonjensen/402c9a3b1803dcf764bc to your computer and use it in GitHub Desktop.
Save jonjensen/402c9a3b1803dcf764bc to your computer and use it in GitHub Desktop.
Decode Google Earth settings pseudo-URL Unicode
#!/bin/env python2
import fileinput
import re
import urllib
def decode_ucs(matchobj):
c = matchobj.group(0)[2:]
i = int(c, 16)
return unichr(i)
for line in fileinput.input():
url = re.sub('_', '/', line)
url = re.sub(r'\\', '', url)
url = urllib.unquote(url).decode('utf8')
url = re.sub('%U[A-F0-9]{4}', decode_ucs, url)
description = re.sub('^http://kh.google.com:80/', '', url)
print(line + description)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment