Last active
December 2, 2025 13:34
-
-
Save atoponce/ebbed45d66b1d8a6dc557520d88cadce to your computer and use it in GitHub Desktop.
Print "white space" of various types to see how they look and behave in different terminal emulators for password generators.
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/env zsh | |
| # | |
| # Released to the public domain | |
| # | |
| # - No C0 control codes, except: | |
| # - \u0009: tab character | |
| # - \u001C: file separator (largest) | |
| # - \u001D: group separator | |
| # - \u001E: record separator | |
| # - \u001F: unit separator | |
| # - \u0020: space (character separator, smallest) | |
| # | |
| # - No C1 control codes, exept: | |
| # - \u0089: tab character with justification | |
| # - \u008A: line tabulation, basically a vertical tab | |
| # - \u008B: partial line forward | |
| # - \u00A0: no-break space | |
| # - \u00AD: soft hyphen | |
| # | |
| # - No tags | |
| # - No undefined | |
| # - No private use | |
| # - No variation selectors | |
| # - No glyphs or letters | |
| # - No musical symbols | |
| # | |
| # See: | |
| # - https://invisible-characters.com/ | |
| # - https://en.wikipedia.org/wiki/Unicode_control_characters | |
| # - https://en.wikipedia.org/wiki/Whitespace_character#Unicode | |
| tabs -1 | |
| declare -A horiz zwhoriz zwvert tofu bidir graph | |
| print_chars() { | |
| local code | |
| local char | |
| typeset -A chars=(${(@Pkv)1}) | |
| for code char in ${(@kv)chars}; do | |
| print -rP -- "\\${code}: \"${char}\"" | |
| done | |
| print # blank line | |
| } | |
| # Non-zero width horizontal (23 characters) | |
| local horiz=( | |
| [u0009]=$'\u0009' # Character tabulation | |
| [u0020]=$'\u0020' # Space | |
| [u0089]=$'\u0089' # Character tabulation with justification | |
| [u00A0]=$'\u00A0' # No-break space | |
| [u115F]=$'\u115F' # Hangul choseong filler | |
| [u1160]=$'\u1160' # Hangul jungseong filler | |
| [u2000]=$'\u2000' # En quad | |
| [u2001]=$'\u2001' # Em quad | |
| [u2002]=$'\u2002' # En space | |
| [u2003]=$'\u2003' # Em space | |
| [u2004]=$'\u2004' # Three-per-em space | |
| [u2005]=$'\u2005' # Four-per-em space | |
| [u2006]=$'\u2006' # Six-per-em space | |
| [u2007]=$'\u2007' # Figure space | |
| [u2008]=$'\u2008' # Punctuation space | |
| [u2009]=$'\u2009' # Thin space | |
| [u200A]=$'\u200A' # Hair space | |
| [u202F]=$'\u202F' # Narrow no-break space | |
| [u205F]=$'\u205F' # Medium mathematical space | |
| [u2800]=$'\u2800' # Braille pattern blank | |
| [u3000]=$'\u3000' # Ideographic space | |
| [u3164]=$'\u3164' # Hangul filler | |
| [uFFA0]=$'\uFFA0' # Halfwidth hangul filler | |
| ) | |
| # Zero width horizontal (17 characters) | |
| local zwhoriz=( | |
| [u001C]=$'\u001C' # File separator | |
| [u001D]=$'\u001D' # Group separator | |
| [u001E]=$'\u001E' # Record separator | |
| [u001F]=$'\u001F' # Unit separator | |
| [u034F]=$'\u034F' # Combining grapheme joiner | |
| [u17B4]=$'\u17B4' # Khmer vowel inherent AQ | |
| [u17B5]=$'\u17B5' # Khmer vowel inherent AA | |
| [u180E]=$'\u180E' # Mongolian vowel separator | |
| [u200B]=$'\u200B' # Zero width space | |
| [u200C]=$'\u200C' # Zero width non-joiner | |
| [u200D]=$'\u200D' # Zero width joiner | |
| [u2060]=$'\u2060' # Word joiner | |
| [u2061]=$'\u2061' # Function application | |
| [u2062]=$'\u2062' # Invisible times | |
| [u2063]=$'\u2063' # Invisible separator | |
| [u2064]=$'\u2064' # Invisible plus | |
| [uFEFF]=$'\uFEFF' # Zero width no-break space | |
| ) | |
| # Zero width vertical (4 characters) | |
| local zwvert=( | |
| [u008A]=$'\u008A' # Line tabulation | |
| [u008B]=$'\u008B' # Partial line forward | |
| [u2028]=$'\u2028' # Line separator | |
| [u2029]=$'\u2029' # Paragraph separator | |
| ) | |
| # Bidirectional text control (18 characters) | |
| local bidir=( | |
| [u061C]=$'\u061C' # Arabic letter mark | |
| [u200E]=$'\u200E' # Left-to-right mark | |
| [u200F]=$'\u200F' # Right-to-left mark | |
| [u202A]=$'\u202A' # Left-to-right embedding | |
| [u202B]=$'\u202B' # Right-to-left embedding | |
| [u202C]=$'\u202C' # Pop directional formatting | |
| [u202D]=$'\u202D' # Left-to-right override | |
| [u202E]=$'\u202E' # Right-to-left override | |
| [u2066]=$'\u2066' # Left-to-right isolate | |
| [u2067]=$'\u2067' # Right-to-left isolate | |
| [u2068]=$'\u2068' # First strong isolate | |
| [u2069]=$'\u2069' # Pop directional isolate | |
| [u206A]=$'\u206A' # Inhibit symmetric swapping | |
| [u206B]=$'\u206B' # Activate symmetric swapping | |
| [u206C]=$'\u206C' # Inhibit arabic form shaping | |
| [u206D]=$'\u206D' # Activate arabic form shaping | |
| [u206E]=$'\u206E' # National digit shapes | |
| [u206F]=$'\u206F' # Nominal digit shapes | |
| ) | |
| # Possible tofu (4 characters) | |
| local tofu=( | |
| [uFFF9]=$'\uFFF9' # Interlinear annotation anchor | |
| [uFFFA]=$'\uFFFA' # Interlinear annotation separator | |
| [uFFFB]=$'\uFFFB' # Interlinear annotation terminator | |
| [uFFFC]=$'\uFFFC' # Object replacement character | |
| ) | |
| # Possibly graphical (4 characters) | |
| local graph=( | |
| [u00AD]=$'\u00AD' # Soft hyphen | |
| [u1680]=$'\u1680' # Ogham space mark | |
| [u13441]=$'\u13441' # Egyptian hieroglyph full blank | |
| [u13442]=$'\u13442' # Egyptian hieroglyph half blank | |
| ) | |
| print "Non-zero width horizontal (${#horiz[@]} characters):" | |
| print_chars horiz | |
| print "Zero width horizontal (${#zwhoriz[@]}) characters:" | |
| print_chars zwhoriz | |
| print "Zero width vertical (${#zwvert[@]}) characters:" | |
| print_chars zwvert | |
| print "Bidrectional text control (${#bidir[@]}) characters:" | |
| print_chars bidir | |
| print "Possible tofu (${#tofu[@]}) characters:" | |
| print_chars tofu | |
| print "Possible graphical (${#graph[@]}) characters:" | |
| print_chars graph | |
| tabs -8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment