Show printable ASCII characters only
-
Greetings from a new visitor. I have used n++ for a decade occasionally and just updated (plugin manager seems to be hiding but explanations are so strange, I figure out installation error but no warning during installation of what was to come)
I downloaded the file compare plugin today, installed it manually and it was very helpful as well.
I have been recovering from a Firefox profile upset and had occasion to look inside various files in the profile folder and sub folders.
They have lots of various formats that I am not too concerned with. However to determine the sort of stuff the files contain when possible I like to see if the visible text reminds me of useful stuff to decide if I want to copy the file, try and parse it more carefully or just ignore it.
I am wondering if there is a plug in that will hide non-printable characters or perhaps even a language filter that could be coaxed to do so?
Alternately if someone can think of a very small and similar open source plugin that I would investigate and hack to fit my needs perhaps I could try my hand one day at writing a plug in to do what is needed.
I am a decade out of practice with coding but might be able to figure out what GitHub all about.
It just needs to display the text no editing required, copy selection to clipboard optional extra.
-
the plugin manager is deprecated and has been replaced by plugin admin.
I am not aware of any existing plugin that does what you want, but the
errorlist lexer basically does something similar. Here is described how to build such a lexer
and here is the required style attribute you are looking for.However, it would be easier to define a UDL that emphasizes the ASCII characters more.
-
@KalleMP said in Show printable ASCII characters only:
hide non-printable characters
An approach that might get you close to what you want is to use a regex to match every char that is not something you want to see, and replace it with empty:
Fi:
[^A-Z0-9a-z\\\^\]\r\n`~!@#$%^&*()-_+=[{}|;:'",<.>/?]
Re:(empty)
I ran it on a .chm and .dll and it seems to work.
It’s a bit slow with large files.
Since it’s changing and not just hiding you have to take care to not save.
-
Hello @kallemp, @ekopalypse, @neil-schipper and All,
Neil, regarding the regex method, here are two other solutions where I suppose, by extension, that the
Tabulation
and theSpace
characters are considered as printable chars !-
SEARCH
(?s)(?![\x{0020}-\x{007E}\t\r\n]).
-
REPLACE
\xA0
OR
-
SEARCH
(?-i)[^]!"#$%&'()*+,.0-9/:;<=>?@A-Z[\\^_\x60a-z{|}~\x20\t\r\n-]
-
REPLACE
\xA0
Notes :
-
I replace any non-printable character with a
No-Break-Space
char which does not displays any gliph, even if you click on the¶
button ! -
Unfortunately, these replacements, instead of your suppresion method, is about
3
times slower :-((
Best Regards,
guy038
-
-
Hi @guy038
the Tabulation and the Space characters
Including tab did actually flit thru my mind as I was prepping the expression… but then flew away. I totally forgot about space.
As for subbing in a space for the non-printables, I can see both how someone might prefer to preserve the positions of printable text, as well as preferring to delete them to make the text more compact, so it’s good that @kallemp has the option.
As for the benefit of
No-Break-Space
vs conventional space, that under Show all Chars it resolves ambiguity between a space from the original text and a non-printable that got hidden, that’s interesting, thanks. (If there’s more to it than that, I’m not seeing it.)But then for completeness, it should also be stated that if the original text happens to have a lot of
A0
, then ambiguity may actually be increased.Also for completeness, it should be stated that if there is a desire to see some of the extended characters (Euro language chars w/accents, different currency symbols, etc) any of the above 3 expressions would need to be tweaked accordingly.
Best,
Neil -
I keep getting notifications about new posts (specifically just got one on this thread), but when I go to them, I don’t see new content. What gives?
I certainly hope that someone with moderator powers isn’t “changing the past”; if they are I certainly request that they STOP DOING THAT, and spend their efforts on more worthy tasks.
-
I just got an email notification that this Mar/22 contribution of Guy’s mentions me, but the comment is neither new nor newly edited.
-
(Sorry to continue the off-topicness of recent posts in this thread)
Now I see:
with no visible “LATE DATE EDIT:” annnotations visible anywhere in these older posts.
It seems @guy038 is for some reason editing old posts, with no way for anyone to know what is changing. Guy I’d politely request that you cease this behavior; otherwise I’d request of other moderators here to petition for removing Guy’s moderator powers.
-
@Alan-Kilborn said in Show printable ASCII characters only:
It seems @guy038 is for some reason editing old posts
I think you are not properly understanding the conspiracy:
It’s not that Guy is editing his posts.
It’s that someone is working hard to call my attention to threads in which my contribution was effing lame.
-
@Neil-Schipper said in Show printable ASCII characters only:
It’s not that Guy is editing his posts.
It’s that someone is working hard to call my attention to threads in which my contribution was effing lame.I think you are being humorous with some self-deprecating comments?
Guy IS editing old posts. -
@Alan-Kilborn said in Show printable ASCII characters only:
Guy IS editing old posts.
I had queried him a few days ago. When he replied it was to say that @PeterJones had also queried it. Apparently his edits are benign, of course we have to take his word on that.
It is a bit disconcerting that someone edits posts so long ago. Of course it’s also a bit disconcerting about the recent change in ability of normal users to edit posts for a longer period of time as well. It means someone can answer with a solution only to find the specifics of the request have changed in the intervening period.
Terry
-
@Terry-R said in Show printable ASCII characters only:
Apparently his edits are benign
Even “benign” edits are annoying because I get a notification that there is something “new” to read. And even if such edits are “harmless”, they should be documented (like Peter will do) with an “EDIT: …” at the bottom explaining what was done.
If an edit is so harmless that typing an “EDIT: …” explanation at the bottom would be silly…WHY even make that edit in the first place? Leave old postings the way they are (find better things to do with your time).
It means someone can answer with a solution only to find the specifics of the request have changed in the intervening period.
I agree and have made these feelings known, but no further changes came from that.