ASCII Hex of Current Character



  • Hi, Is there a setting in notepad++ that displays the ASCII hex of the current character under the cursor? Edit plus has this feature that displays it beside the line number and column number. If so, how can I activate it in Notepad++?



  • @iamtestplay

    I don’t believe this is possible…without scripting. With scripting (e.g. Pythonscript plugin), however, it is fairly straightforward–for the simplistic case of ASCII and not Unicode–if you don’t mind part of the statusbar being utilized for the display:

    Imgur

    Script:

    def callback_sci_UPDATEUI(args):
        c = editor.getCharAt(editor.getCurrentPos())
        try:
            info = "HEX:{0:02X} DEC:{0} '{1}'".format(c, chr(c) if c not in [13, 10, 0] else 'LINE-ENDING' if c != 0 else 'END-OF-FILE')
        except ValueError:
            info = "HEX:?? DEC:?"
        notepad.setStatusBar(STATUSBARSECTION.DOCTYPE, info)
    editor.callback(callback_sci_UPDATEUI, [SCINTILLANOTIFICATION.UPDATEUI])

Log in to reply