[intellij-idea] How to display hidden characters by default (ZERO WIDTH SPACE ie. &#8203)

I just lost part of my weekend because of this ... joker - zero width space. I just used some snippets from google groups and didn't recognize that there are doubled characters, because Idea (11) didn't show them, which was causing problems with parsing config file of my app... I discovered it accidentally in vi.

Is there any way to display such things in IntelliJ (or some other way to examine files) without using external editors.

IntelliJ 11 / Mac OS 10.7

edit - sample

These two lines looks identical, in browser and also in Idea. You can see in page's code that in first - commented line there is hidden zero width space between mysql:// and localhost, which causes problems. Of course if you expect that 'joker', you can try to use search and replace it, however nobody expects the sign that should not be there, especially if he cannot see it in any way.

#db.default.url="jdbc:mysql://?localhost/play-fullcalendar"
 db.default.url="jdbc:mysql://localhost/play-fullcalendar"

This question is related to intellij-idea phpstorm whitespace

The answer is


Not sure what you meant, but you can permanently turn showing whitespaces on and off in Settings -> Editor -> General -> Appearance -> Show whitespaces.

Also, you can set it for a current file only in View -> Active Editor -> Show WhiteSpaces.

Edit:

Had some free time since it looks like a popular issue, I had written a plugin to inspect the code for such abnormalities. It is called Zero Width Characters locator and you're welcome to give it a try.


A very simple solution is to search your file(s) for non-ascii characters using a regular expression. This will nicely highlight all the spots where they are found with a border.

Search for [^\x00-\x7F] and check the box for Regex.

The result will look like this (in dark mode):

zero width space made visible


Examples related to intellij-idea

IntelliJ: Error:java: error: release version 5 not supported Has been compiled by a more recent version of the Java Runtime (class file version 57.0) Error: Java: invalid target release: 11 - IntelliJ IDEA IntelliJ can't recognize JavaFX 11 with OpenJDK 11 Error: JavaFX runtime components are missing, and are required to run this application with JDK 11 ERROR Source option 1.5 is no longer supported. Use 1.6 or later Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6 How to configure "Shorten command line" method for whole project in IntelliJ intellij idea - Error: java: invalid source release 1.9 Failed to resolve: com.google.android.gms:play-services in IntelliJ Idea with gradle

Examples related to phpstorm

Difference between WebStorm and PHPStorm Cannot ignore .idea/workspace.xml - keeps popping up JetBrains / IntelliJ keyboard shortcut to collapse all methods Can IntelliJ IDEA encapsulate all of the functionality of WebStorm and PHPStorm through plugins? Word wrapping in phpstorm How to display hidden characters by default (ZERO WIDTH SPACE ie. &#8203) How to make phpstorm display line numbers by default? How do you debug PHP scripts?

Examples related to whitespace

How to create string with multiple spaces in JavaScript git: fatal: I don't handle protocol '??http' Show whitespace characters in Visual Studio Code What is the symbol for whitespace in C? How to print variables without spaces between values Trim whitespace from a String How do I escape spaces in path for scp copy in Linux? Avoid line break between html elements Remove "whitespace" between div element How to remove all white spaces in java