Skip to content

Instantly share code, notes, and snippets.

@PeteGoo
Created January 21, 2015 04:24
Show Gist options
  • Save PeteGoo/62190013610caec1e6d9 to your computer and use it in GitHub Desktop.
Save PeteGoo/62190013610caec1e6d9 to your computer and use it in GitHub Desktop.
Sublime Text ASCII character display
import sublime, sublime_plugin, textwrap, unicodedata
# from http://stackoverflow.com/questions/22063366/show-info-about-current-character-in-status-bar-in-sublime-text-2
class utfcodeCommand(sublime_plugin.EventListener):
def on_selection_modified(self, view):
# some test chars = $ €
sublime.status_message('Copying with pretty format')
selected = view.substr(view.sel()[0].a)
char = str(selected)
view.set_status('Charcode', "ASCII: " + str(ord(selected)) + " UTF: " + str(char.encode("unicode_escape"))[2:-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment