Jump to content

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


Recommended Posts

Has anyone else noticed this?

EXAMPLE:

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

ErrorCode.jpg.88f4c817f9128a23c8d10ffed0cca3de.jpg

Figure 2

ForumCode.jpg.00996f234eb1c4af9d1852da943f4c16.jpg

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

#AutoIt3Wrapper_Icon=iconfinder_470-Clipboard_2124487.ico
ClipPut(StringRegExpReplace(ClipGet(), '[\x{0000}\x{FEFF}\x{200B}-\x{200D}]', ""))
;~  \x{0000}    NULL
;~  \x{FEFF}    ZERO WIDTH NO-BREAK SPACE
;~  \x{200B}    ZERO WIDTH SPACE
;~  \x{200C}     ZERO WIDTH NON-JOINER
;~  \x{200D}     ZERO WIDTH JOINER

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

iconfinder_470-Clipboard_2124487.ico

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

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
 Share

  • Recently Browsing   0 members

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