Created
September 6, 2016 20:38
-
-
Save thieux/cf6cd597a60f679024d30c827deb6324 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
function uw() { | |
iconv --from-code=utf8 --to-code=windows-1252 | |
} | |
function wu() { | |
iconv --from-code=windows-1252 --to-code=utf8 | |
} | |
function ui() { | |
iconv --from-code=utf8 --to-code=iso8859-1 | |
} | |
function iu() { | |
iconv --from-code=iso8859-1 --to-code=utf8 | |
} | |
function ui15() { | |
iconv --from-code=utf8 --to-code=iso8859-15 | |
} | |
function i15u() { | |
iconv --from-code=iso8859-15 --to-code=utf8 | |
} | |
echo [EUR in windows-1252] | |
echo -n € | uw | hexdump | |
echo [EUR not mapped in iso8859-1] | |
echo -n € | ui | hexdump | |
echo [EUR mapped in iso8859-15] | |
echo -n € | ui15 | hexdump | |
# | |
echo [windows-1252 mapping] | |
echo éèàêç | uw | wu | |
echo [iso8859-1 mapping] | |
echo -n éèàêç | ui | iu | |
echo [iso8859-15 mapping] | |
echo éèàêç | ui15 | i15u | |
# | |
echo [windows-1252] | |
echo -n éèàêç | uw | hexdump | |
echo [iso8859-1] | |
echo -n éèàêç | ui | hexdump | |
echo [iso8859-15] | |
echo -n éèàêç | ui15 | hexdump | |
# | |
echo [interpret utf8 as windows-1252] | |
echo éèàêç | wu # éèà êç |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment