Skip to content

Instantly share code, notes, and snippets.

@mkrasowski
Last active December 17, 2015 19:39
Show Gist options
  • Save mkrasowski/5661541 to your computer and use it in GitHub Desktop.
Save mkrasowski/5661541 to your computer and use it in GitHub Desktop.
Convert special characters `less' pager displays as their hexadecimal representation into their binary form.
Example:
"ma<B3>gorzata posz<B3>a do domu"
`<B3>' which stands for `ł' character in cp1250 encoding
which gets decoded to "małgorzata poszła do domu"
Example application in vim editor
Place the script in your $PATH
and execute:
:%!lessencfix.pl
#!/usr/bin/perl
do {
s/\<([0-9A-F]{2})\>/chr(hex($1))/ge;
print;
} while(<>);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment