4 Commits

Author SHA1 Message Date
  Alois Mahdal 8875772d4d Bump version 5 years ago
  Alois Mahdal 4750ad76f3 Elaborate more in the docstring 5 years ago
  Alois Mahdal d7193295d0 Replace, don't remove control characters 5 years ago
  Alois Mahdal b1f3060143 Don't (mis)use tr/// to remove non-printables 5 years ago
2 changed files with 6 additions and 3 deletions
  1. 1
    1
      mkit.ini
  2. 5
    2
      src/include-sh/coerce.sh

+ 1
- 1
mkit.ini View File

@@ -1,5 +1,5 @@
1 1
 [project]
2
-    version     = 0.10.16
2
+    version     = 0.10.17
3 3
     codename    = FloatingPointError
4 4
     name        = Shellfu
5 5
     tagline     = Shell dot on steroids

+ 5
- 2
src/include-sh/coerce.sh View File

@@ -25,9 +25,12 @@ coerce__nocolor() {
25 25
 
26 26
 coerce__noctl() {
27 27
     #
28
-    # Remove non-printable characters
28
+    # Replace non-printable characters with $COERCE__REPCHAR
29 29
     #
30
-    perl -CS -Mutf8 -pe 'tr|[:graph:]\n\t ||c;'
30
+    # Keep only characters that have grapgical representation ([:graph:] POSIX
31
+    # class), newline, tab and space.  Replace rest with $COERCE__REPCHAR.
32
+    #
33
+    perl -CS -Mutf8 -pe "s|[^[:graph:] \t\n]|$COERCE__REPCHAR|g"
31 34
 }
32 35
 
33 36
 coerce__nofdraw() {