g | x | w | all
Bytes Lang Time Link
009Japt !240812T222143ZShaggy
034C gcc240803T130133ZMaya
084Desmos240719T014706ZW D
558Uiua240723T054957ZEurope20
054C gcc240722T012045ZDigital
009MATL240717T162439ZLuis Men
064Java240719T190530Zswpalmer
036Raku Perl 6 rakudo240719T071100Zbb94
068Go240718T005925Zbigyihsu
030JavaScript ES6240717T160651ZArnauld
036Python 3240717T141641ZJitse
016K ngn/k240719T041846Zakamayu
018x8664 machine code function240718T195509ZPeter Co
007Jelly240717T141820Zhyper-ne
024K ngn/k240718T135912ZAshy
006Vyxal240717T140602Zlyxal
147Nibbles240718T092631ZDominic
044Bash240717T151013ZThemooni
040R240717T152918ZDominic
00905AB1E240718T064459ZKevin Cr
030JavaScript Node.js240718T032003Zl4m2
011Charcoal240717T213655ZNeil
036APL+WIN240717T182357ZGraham

Japt -!, 9 bytes

;s#òd)kE

Try it

;s#òd)kE     :Implicit input of integer
 s            :Convert to string in base
  #          :  127 (note the unprintable after the #)
    ò         :  Range [0,127]
     d        :    Character at each codepoint
      )       :End base conversion
       k      :Remove characters in
;       E     :  ASCII
              :Implicit output of logical NOT of resulting string

C (gcc), 35 34 bytes

f(n){while(n&&95-~n%128>>7)n>>=7;}

Try it online!

Desmos, 84105 bytes

Thanks to Aiden Chow for removing B(x) and 21 bytes

k=128
f(n)=\left\{31<mod(floor(n/k^{[0...floor(log_k(n+0^n))]}),k)<k-1,0\right\}.min

Try it on Desmos (with test cases)


Explanation

f(x) checks each character's printability, returning 1 for printable text and 0 for unprintable text.


If you are pasting this in to try yourself, you may need to "activate" the f(n) equation by focusing (clicking) on it and pressing either the left or right arrow key on your keyboard or the built-in Desmos keyboard. This is likely because I don't use the backslashes in \join, \floor, \mod etc. (not sure how Desmos breaks when this happens though), so this solution is susceptible to Desmos bugfixes breaking my code I guess
Or you can paste in the f(n) line individually because that works I guess

Uiua, 55 bytes (UTF-8), 30 chars

c ← 128
/↧∊:+32⇡95⌊◿c÷ⁿ:c⇡⌈ₙc.

C (gcc), 54

Non recursive solution:

f(n,a){a=1;for(n=n?:1;n&&(a=isprint(n&127));n>>=7);a;}

Try it online!

C (gcc), 55

Recursive solution is 1 byte longer:

g(n){n=n?isprint(n&127)?g(n>>=7):0:1;}f(n){n=n?g(n):0;}

Try it online!

MATL, 10 9 bytes

7W_YA6Y2m

Outputs a vector of ones (which is truthy) or a vector containing at least a zero (which is falsy) depending on whether the result only uses printable ASCII or not.

Try it online! Or verify all test cases (the code includes test for truthiness/falsihood).

Explanation

      % Implicit input
7W    % 7, base-2 exponentiation: gives 128
_YA   % Convert to base 128
6Y2   % Push ASCII range (predefined literal): ' ':'~'
m     % Ismember (element-wise)
      % Implicit display

Java, 64 bytes

x->{if(x==0)x=1;while(x%128!=127&&x%128>31){x>>=7;}return x==0;}

Raku (Perl 6) (rakudo), 41 36 bytes

Returns 0 for false and a non-zero integer for true.

{$_*?(127>.polymod(128 xx*).all>31)}

Attempt This Online!

Go, 75 68 bytes

func f(n int)bool{for k:=n;k>0;k>>=7{if -^k%128<33{n=0}}
return n>0}

Attempt This Online!

Based on @Jitse's answer.

Does not swap true and false.

JavaScript (ES6), 30 bytes

Very similar to Jitse's answer.

Returns 0 for printable or true for non-printable.

f=n=>-~n%128<33||(n>>=7)&&f(n)

Try it online!


JavaScript (ES6), 27 bytes

-2 thanks to @tsh

Returns 0 for printable / truthy for non-printable.

f=n=>-~n%128<33||f(n>>=7)*n

Try it online!

Python 3, 36 bytes

f=lambda n:-~n%128<33or f(n>>7)*n>>7

Try it online!

Outputs with truthy and falsey swapped

-2 bytes thanks to Themoonisacheese

-2 bytes thanks to squareroot12621

-2 bytes thanks to Albert.Lang

-1 byte thanks to Jonathan Allan

K (ngn/k), 16 bytes

1~&/~32 127'128\


            128\   /decode in base 128
     32 127'       /-1 if <32, 0 if 32<=x<127, 1 if 127<x
  &/~              /all 0?
1~                 /is 1? (since the unit element for & is 9223372036854775807

Try it online!

x86-64 machine code function, 18 bytes

Integer arg in ECX, bool return value in AL (actually zero-extended to RAX). If I'd used EDI for the arg, this would be compatible with the x86-64 System V calling convention. As-is, it's Windows x64.

NASM listing trimmed to show hexdump of machine code and source.

                 ; takes a string of ASCII digits packed into a 32-bit integer
                 packedascii_is_printable:
                 .loop:
 8D4101            lea  eax, [rcx+1]   ; wrap 0x7f to 0x80 = -128 if we use a signed compare.  Or to 0 since this is before AND
                             ; 32-bit alternative  mov eax, ecx  (2 bytes) ;  inc eax  (1 byte) before or after AND
 247F              and  al, 0x7F        ; isolate low 7 bits - one ASCII character
 3C21              cmp  al, 0x21        ; increment by one mapped the printable range to 0x21 - 0x7f from the usual 0x20 - 0x7e
 0F9DC0            setge al             ; set return value according to most recent character checked
 7C05              jl   .found_false    ; early out on first false, else keep checking
 C1E907            shr  ecx, 7
 75EF              jnz  .loop           ; leave the loop after processing all the set bits, since our input numbers aren't actually fixed-width in bits.
                 .found_false:
 C3                ret
                         
                 ; return value in AL (zero extended to EAX, actually, since we don't exit the loop until high bits of ECX are clear)

We add 1 and copy the low 7-bit character into AL, and isolate it with AND. Then check if it's 0x21 to 0x7f, i.e. if the original was 0x20 to 0x7e. Since every 7-bit value is <= 0x7f, we only have to check the low end of the range, hence adding 1.

This isn't as compact as I'd like, it feels like there should be a way to avoid both a branch and a 3-byte setcc. Perhaps I could make use 32-bit mode for salc if I can use an unsigned compare. (Undocumented opcode that sets AL according to CF). I think I can since we cmp after clearing the high bit.

Jelly, 7 bytes

bØ⁷ỌḟØṖ

Try It Online!

bØ⁷ỌḟØṖ    main link
b          convert to base
 Ø⁷                        128
   Ọ       convert to characters
    ḟ      filter to remove
     ØṖ    printable ASCII

If anything is left after the filter (i.e. the return value is a non-empty list), then it's the false case. If the filter removes everything (i.e. the return value is an empty list), then it's the true case. The footer uses (logical NOT) to map [] -> true and [...] -> false.

K (ngn/k), 24 bytes

f:{&/(a<127),31<a:128\x}

Try it online!

Vyxal, 6 bytes

₇τCkQF

Try it Online!

Outputs an empty list for truthy, a non-empty list for falsey.

Nibbles, 14 nibbles (7 bytes)

Program bytes:

d9 87 12 08 3a dd 3b

Human-readable representation:

,|`@128$\ch$P

Attempt This Online!

Outputs zero (falsy) for only-printable-ASCII input, or a positive integer (truthy) for input containing unprintable base-128 digits.

Explanation:

,|`@128$\ch$P   
,               # length of
 |              #   keep
        \   P   #     only unprintable ASCII
         ch$    #   from character representations of
       $        #   input
  `@128         #   as base-128 digits

Note: Typically, Nibbles programs are written using human-readable (kind-of) tokens representing single-nibble or two-nibble elements. The Nibbles interpreter should then encode these into the final, runnable program code.
In this case, though, for unknown (to me) reasons, the Nibbles interpreter outputs a warning and refuses to encode this program, even though it runs it correctly. Nevertheless, it is possible to manually write the 7 program bytes d9 87 12 08 3a dd 3b directly to a file, and run this, as shown.
This is not the normal way to write or run a Nibbles program, but it works.

enter image description here

Bash, 54 44 bytes

-10 bytes by Dominic van Essen and GammaFunction

(($1%128%127>31))&&((($1<128))||$0 $[$1>>7])

Attempt This Online!

54 bytes

Use as a bash script. Takes in number as first argument, returns with 1 for false and 0 for true (bash convention).
ATO link assumes the function is named f because $0 doesn't work in ATO, but the penalty for hardcoding the script name would be a single byte, so the score would be the same.

Turns out this is a port of @Jitse's answer, but i came up with it independently.

R, 44 43 40 bytes

Edit: -3 bytes thanks to pajonk

f=\(x)(x+1)%%128>31&(!(y=x%/%128)||f(y))

Attempt This Online!

05AB1E, 9 bytes

žQÇIžyвåP

Try it online or verify all test cases.

Explanation:

žQ         # Push printable ASCII constant: " !"...|}~"
  Ç        # Convert it to a list of codepoint integers: [32,126]
   I       # Push the input-integer
    žyв    # Convert the (base-10) input to a base-128 list
       å   # Check for each value if it's in the [32,126]-list
        P  # Check if all are truthy
           # (which is output implicitly as result)

JavaScript (Node.js), 30 bytes

f=n=>-~n%128<33?n<!!n:f(n/128)

Try it online!

Same length with Arnauld but somehow nicer output

JavaScript (Node.js), 26 bytes

f=n=>-~n%128<33?!n:f(n>>7)

Try it online!

Worse input

Charcoal, 11 bytes

⌊⍘N⭆¹²⁸№γ℅ι

Try it online! Link is to verbose version of code. Actually outputs 1 or 0 for once. Explanation:

  N         Input as a number
 ⍘          Convert to custom string base
    ¹²⁸     Literal integer `128`
   ⭆        Map over implicit range and join
       №    Count of
          ι Current value
         ℅  Convert to Unicode
        γ   In printable ASCII
⌊           Take the minimum
            Implicitly print

Would have been 10 bytes if the output for 0 was truthy as @xnor suggests:

⬤↨N¹²⁸№γ℅ι

Try it online! Link is to verbose version of code. Outputs a Charcoal boolean, i.e. 1 if all of the characters a printable ASCII, nothing if not. Explanation:

  N         Input as a number
 ↨          Converted to base
   ¹²⁸      Literal integer `128`
⬤           All values satisfy
      №     Count of
         ι  Current value
        ℅   Convert to Unicode
       γ    In printable ASCII
            Implicitly print

APL+WIN, 36 bytes

Prompts for integer. Index origin=0. 1=true, 0=false

(+/v∊32+⍳95)=⍴v←((⌈128⍟2⌈n)⍴128)⊤n←⎕

Try it online! Thanks to Dyalog Classic