Questions tagged [non-printable]

A character code that does not represent a written symbol, and is usually a printing or telecommunication control character.

See the Control character Wikipedia article for more info.

33 questions
107
votes
16 answers

Stripping non printable characters from a string in python

I use to run $s =~ s/[^[:print:]]//g; on Perl to get rid of non printable characters. In Python there's no POSIX regex classes, and I can't write [:print:] having it mean what I want. I know of no way in Python to detect if a character is…
Vinko Vrsalovic
  • 330,807
  • 53
  • 334
  • 373
58
votes
7 answers

How do I replace or find non-printable characters in vim regex?

I have a file with some non-printable characters that come up as ^C or ^B, I want to find and replace those characters, how do I go about doing that?
Charles Ma
  • 47,141
  • 22
  • 87
  • 101
19
votes
4 answers

How to remove all special characters in Linux text

How to remove the special characters shown as blue color in the picture 1 like: ^M, ^A, ^@, ^[. In my understanding, ^M is a windows newline character, I can use sed -i '/^M//g' to remove it, but it doesn't work to remove others. The command…
vinllen
  • 1,369
  • 2
  • 18
  • 36
13
votes
1 answer

Detect non-printable characters in JavaScript

Is it possible to detect binary data in JavaScript? I'd like to be able to detect binary data and convert it to hex for easier readability/debugging. After more investigation I've realized that detecting binary data is not the right question,…
deepwell
  • 20,195
  • 10
  • 33
  • 39
5
votes
4 answers

Conversion of strings containing non printable characters

I would like to convert a byte array containing non printable characters to string for my application. When I convert back to byte array, the contents of the array should remain the same as I found that ASCII/Unicode/UTF8 doesnt always give me the…
user1029660
  • 53
  • 1
  • 5
5
votes
2 answers

How to detect and replace non-printable characters in a string using Java?

For instance I have a string like this : abc123[*]xyz[#]098[~]f9e [*] , [#] and [~] represents 3 different non-printable characters. How can I replace them with "X" in Java ? Frank
Frank
  • 30,590
  • 58
  • 161
  • 244
5
votes
2 answers

String corruption and nonprintable characters using XML::Twig in Win32 Perl

This is a really weird problem. It's taken me practically all day to whittle it down to a small executable script that demonstrates the problem fully. Problem Summary: I'm using XML::Twig to pull a data snippet from an XML file, then I'm sticking…
Kurt W. Leucht
  • 4,725
  • 8
  • 33
  • 45
4
votes
1 answer

Grepping non printable characters by Cygwin

Grepping non printable characters doesn't seem to work for carriage return (control key ^M). usr@R923047 ~ $ head -3 test.ctl row 1 row 2 row 3 usr@R923047 ~ $ head -3 test.ctl | cat -nv 1 row 1^M 2 row 2^M 3 row 3 usr@R923047 ~ $…
inzzz
  • 885
  • 1
  • 10
  • 13
4
votes
1 answer

RegEx in Excel VBA Matching Extended ASCII Chars Improperly

I'm trying to remove all non-printable and non-ASCII (extended) characters using the following RegEx in Excel VBA: [^\x09\0A\0D\x20-\xFF] This should theoretically match anything that's not a tab, linefeed, carriage return or printable ASCII…
ChaosFreak
  • 574
  • 1
  • 6
  • 18
4
votes
1 answer

How to check if a character will display in the browser

If I want to display a special character like ⬀, ⤴ or ➶, How can I see if the user's browser can display it? I don't want the character to come out as ▯; if it would, I'd rather display a normal ↗. So how can I ensure that whatever character I emit…
Mr Lister
  • 45,515
  • 15
  • 108
  • 150
4
votes
3 answers

PERL to count non-printable characters

I have 100,000's of files that I would like to analyze. Specifically I would like to calculate the percentage of printable characters from a sample of the file of arbitrary size. Some of these files are from mainframes, Windows, Unix, etc. so it…
Stan
  • 905
  • 9
  • 20
4
votes
1 answer

Why does the POSIX "printable characters" class not match a simple string?

I wrote the following script to test the "printable characters" character class, as described here. #!/bin/sh case "foo" in *[:print:]*) echo "found a printable character" ;; *) echo "found no printable characters" ;; esac I expect this…
Matthew
  • 28,056
  • 26
  • 104
  • 170
3
votes
1 answer

Lua: Find hex-value in string

I'm trying to find the hexadecimal non-printable character 00h within a string with Lua. I tried it with an escape character and as a result I get the same location I start in (that's a printable character). I fiddled around with the character…
Zerobinary99
  • 542
  • 2
  • 8
  • 17
3
votes
5 answers

Using MySQL LOAD DATA INFILE with nonprintable character delimiters

I have some vendor data that has the SOH (ASCII character 1) as the field delimiter and STX (ASCII character 2) as the record delimiter. Is it possible to load this data with LOAD DATA INFILE without pre-processing the file and replacing those…
danb
  • 10,239
  • 14
  • 60
  • 76
2
votes
2 answers

Filtering characters missing from the user’s font in Java

I want to build a somewhat simple table with Java (as an exercise) to check for the existence of legal printable Unicode code point in the end-user’s font. Because some fonts cannot print valid code points, I have to know which printable code…
xlep
  • 23
  • 3
1
2 3