Last active
December 17, 2015 19:39
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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