9

I got some special characters in my codes, take a look at:


 a


 
 


It's just shown in frontend with normal characters like an "a". Now the same characters without any normal characters:

Characters starts here








Characters ends here

Ok it looks like this Editor will not save empty 
 , try it with snippet.

<html><p>
    </p></html>

The problem is, in PhpStorm this characters wont be shown, even not with

"settings - Editor - General - Appearance - show whitespaces" or

"settings - Editor - General - Appearance - show method separators"

Only "strg+f, strg+r" will find this characters.

I think this character is an "only-mac-char" :) I'm working with Windows, and I can't test it on mac.

EDIT: Sorry i could identify it as "U+2028 : LINE SEPARATOR" http://www.babelstone.co.uk/Unicode/whatisit.html

The big problem is that phpStorm didn't show anything in the code. Like there is no character, but moving with the arrow keys notice 2 steps at this position, between 2 tags looks like "><" but it's "> <".

Ruwen Gastrock
  • 103
  • 1
  • 1
  • 8
  • What characters are you talking about? In any case -- IDE has no options to show invisible chars or stuff like line ending. – LazyOne Dec 23 '16 at 09:09
  • https://youtrack.jetbrains.com/issue/IDEA-115572 -- consider voting for it – LazyOne Dec 23 '16 at 11:58

1 Answers1

9

Based on your update it is now clear what character you have in mind:

Sorry I could identify it as "U+2028 : LINE SEPARATOR" http://www.babelstone.co.uk/Unicode/whatisit.html

Install and use Zero Width Characters locator 2 plugin: it can detect quite a few invisible characters (e.g. UTF-8 BOOM sequence, non-breakable space, Unicode line separator (your case) etc).

It is implemented as a separate inspection with highest (Error) severity so will be easy to spot or check the whole folder/project just for these issues.


There is a ticket (Feature Request) to have an option to show invisible characters in the editor.

https://youtrack.jetbrains.com/issue/IDEA-115572 -- watch this ticket (star/vote/comment) to get notified on any progress. implemented in 2020.2 version.

Other related tickets:


UPDATE 2021-11-10:
As of 2020.2 version the IDE can show invisible/special symbols right in the editor.

An example:
enter image description here

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • Well, looks like the right plugin... but this will break phpstorm in some files! "out of Memory" when to enter one line seperator. Try it: http://www.fileformat.info/info/unicode/char/2028/index.htm get the "L SEP" Icon under "Java Data", copy and paste it into your phpstorm file (failed in constants.ts). But works in css, html and php files! :) And that's what i need, i hope i will find an option to disable this inspection for some files. – Ruwen Gastrock Jan 09 '17 at 11:51
  • @RuwenGastrock Any Inspection can use Scopes functionality so can be enabled/disabled on this basis. 1) create new Scope and include specific files there 2) In Inspections -- find that particular inspection and add new scope: make it disabled for the scope created in #1 and enabled everywhere else. – LazyOne Jan 09 '17 at 12:04
  • saved me from breakdown! – Offirmo Oct 18 '17 at 00:03
  • @LazyOne Last Year i'd ran into an similar error again. Just as an Info for anyone who is landing here: There is a newer Plugin called: "Zero Width Characters locator 2" i recommend to use that one. – Ruwen Gastrock Jan 09 '20 at 15:47
  • 1
    @RuwenGastrock Thanks for letting me know. Looks like it has the same functionality to me, maybe just updated to be better compatible with new/future IDE versions (the way how it runs inspections, platform compatibility etc) – LazyOne Jan 09 '20 at 16:36
  • similar question: https://stackoverflow.com/questions/9868796/how-to-display-hidden-characters-by-default-zero-width-space-ie-8203 Solution: https://plugins.jetbrains.com/plugin/7448-zero-width-characters-locator just to find your plugin you're looking for. ("Zero Width Characters locator 2": Plugin cannot be found anymore. -> going back to v1 ?!) – Ruwen Gastrock Jul 18 '23 at 13:29
  • 1
    @RuwenGastrock The plugin is still there: https://plugins.jetbrains.com/plugin/12735-zero-width-characters-locator-2 It is just marked as Deprecated as there were no updates for 4 years. But it still seems to work fine for me in the current latest PhpStorm 2023.1.4 – LazyOne Jul 18 '23 at 14:13
  • @LazyOne thanks. Just looked in the plugin store, isn't listed in my phpstorm. I'll try to get it over the website. :) – Ruwen Gastrock Jul 19 '23 at 16:38
  • @RuwenGastrock Yeah. Must be because it's marked as Deprecated, no other explanation. Getting the ZIP from the website and installing it this way must be the only way if you want this particular (v2) plugin. – LazyOne Jul 19 '23 at 17:40