Jump to content

Code copied from forum has invisible characters inserted...? (sometimes)

Recommended Posts

Has anyone else noticed this?


In this post:

If you copy-paste his code, there are bunch of 0x00 characters littered throughout the code, and SciTE throws an error "illegal character".

I wish I had another example, but I can't remember the last time this happened.  But it has happened before.

Does anyone have a work-around for this?

To get that code working, I pasted the code into a hex editor, and replaced all 0x00 with nothing.

Link to comment
Share on other sites

Two things:

1)  How do I do that in SciTE?  In Notepad++ there is a "show all characters" option, but I can't find one in SciTE.

2) I don't know what changed, but the forum post I referenced in the first post now copies correctly...????  (no inserted 0x00 chars)

Link to comment
Share on other sites

Yes, noticed it occurred after a forum upgrade some time ago.  Normally if you run the code in Scite, the console output, will tell you where the illegal character is, I then just place the cursor where the error is and either press backspace or delete, unfortunately you can't see the character within the editor and even with "Show all Characters" in Notepad++.  Example, the code abberration quotes includes ï at the end of the second line (see Figure 1), but doesn't appear in the original code by Malkey.  If you post the code into the forum you will see a red dot where the illegal characters are (see Figure 2).

Figure 1


Figure 2


Link to comment
Share on other sites

Another option I personally prefer. You press Ctrl-H, you check Regular Expression, in Find What, you enter [\xEF\xBB\xBF], and you click Replace All.  Gone are those undesired characters.  Those chars are usually the ones I have...

Link to comment
Share on other sites

I'm so lazy... . It's the driving force of my coding :D

ClipPut(StringRegExpReplace(ClipGet(), '[\x{0000}\x{FEFF}\x{200B}-\x{200D}]', ""))
;~  \x{0000}    NULL
;~  \x{200B}    ZERO WIDTH SPACE
;~  \x{200C}     ZERO WIDTH NON-JOINER
;~  \x{200D}     ZERO WIDTH JOINER

..should it be moved to examples ?  :huggles: 


Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...