non-printable

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 printable or not. What would you do? EDIT: It has to support Unicode characters as well. Th...

printable char in java

Does anyone knows how to detect printable characters in java? After a while ( trial/error ) I get to this method: public boolean isPrintableChar( char c ) { Character.UnicodeBlock block = Character.UnicodeBlock.of( c ); return (!Character.isISOControl(c)) && c != KeyEvent.CHAR_UNDEFINED && ...

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 characters with something more common? ...

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, because binary data can contain regular characters, and non-printable characters. Outis's q...

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 that data snippet into the middle of another piece of data, let's call it parent data. ...

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 ...

Locate files which ONLY contain printable characters in bash script

Hi there, I'm trying to write a bash script that looks at a directory full of files and categorises them as either plaintext or binary. A file is plaintext if it ONLY contains plaintext characters, otherwise it is binary. So far I have tried the following permutations of grep: #!/bin/bash FILES=`ls` for i in $FILES do ########GREP...

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? ...