Last active
April 15, 2022 17:20
-
-
Save knbknb/ab74772fd8e66447964dc4926339fc23 to your computer and use it in GitHub Desktop.
perl: humanreadable display of UTF-8 characters in terminal
This file contains hidden or 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 | |
| # Convert \u1234 sequences (e.g. from Wikipedia) | |
| # to characters the terminal can display. | |
| # | |
| # example call: | |
| # curl -sL -H "Accept: text/turtle" "http://dbpedia.org/resource/Pudding" | uni2utf8.pl | |
| use strict; | |
| use warnings; | |
| binmode(STDOUT, ':utf8'); | |
| while (<>) { | |
| s/\\u([0-9a-fA-F]{4})/chr(hex($1))/eg; | |
| print; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment