Is There an Invisible Character That Is Not Regarded as Whitespace

Is there an invisible character that is not regarded as whitespace?

Try Unicode Character 'ZERO WIDTH SPACE' (U+200B). It is not a Whitespace according to WP: Whitespace#Unicode

The code of StringUtils.isBlank will not bother it:

public static boolean isBlank(String str) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if ((Character.isWhitespace(str.charAt(i)) == false)) {
return false;
}
}
return true;
}

Invisible characters - ASCII

How a character is represented is up to the renderer, but the server may also strip out certain characters before sending the document.

You can also have untitled YouTube videos like https://www.youtube.com/watch?v=dmBvw8uPbrA by using the Unicode character ZERO WIDTH NON-JOINER (U+200C), or in HTML. The code block below should contain that character:

‌‌ 

Is there a specific name for hidden whitespace symbols (\n, \t, etc.)?

All of them are whitespace characters which are intended to move the print head on a terminal. They're also part of a larger set of control characters which are intended to communicate with a print terminal rather than be printed directly. (ASCII was based on earlier systems that managed teletypes, not computer displays.)

"Character sequence" is just a sequence of any characters, so that would be even more general.

The specific syntax of a leading backslash and a character to indicate some other unprintable character is called an escape sequence, and specifically a C-style escape sequence.

Invisible special character

Quoting this answer:

"=C2=A0" represents the bytes C2 A0. However, since this is UTF-8, it
translates to 00A0, which is the Unicode for non-breaking space.

You seem to have a UTF-8 encoded file that contains a non-breaking space. It looks like a space character; but PHP does not see it as a whitespace and it will complain about syntax error.



Related Topics



Leave a reply



Submit