Scite Hexify |
|
This script converts the selection to escaped hex form as used in C. Use Undo to remove the converted form.
For example "abc" -> "\x61\x62\x63", "çïTÊ" in Latin-1 -> "\x8a\xe7\xef\x54\xca", "çïTÊ" in UTF-8 -> "\xc5\xa0\xc3\xa7\xc3\xaf\x54\xc3\x8a".
-- Convert a string to a string of hex escapes function Hexify(s) local hexits = "" for i = 1, string.len(s) do hexits = hexits .. string.format("\\x%2x", string.byte(s, i)) end return hexits end -- Convert the selection to hex escaped form -- command.name.1.*=Hexify Selection -- command.mode.1.*=subsystem:lua,savebefore:no -- command.1.*=HexifySelection function HexifySelection() editor:ReplaceSel(Hexify(editor:GetSelText())) end