35

I want to insert a null character (ASCII Value 00) into an open file in Notepad. A program that is reading this file is expecting 00 at the end, but it's getting the ASCII value for space - 20.

How can I achieve this?

Sathyajith Bhat
  • 61,504
  • 38
  • 179
  • 264
  • 2
    I had hoped that holding Alt and pressing four zero on the numpad would insert the null the same way it inserts all of the fÜn printable characters but it doesn't. –  Oct 26 '09 at 07:06
  • If it did work, you'd only need *two* zeros, not four. `Alt+09` works for Tab, for example. – mbomb007 Mar 13 '17 at 19:38

3 Answers3

28

This is not possible to do with Notepad, however, it can be done with a more advanced editor.

With Notepad++

  1. Go to Edit > Character Panel to show the ASCII Insertion Panel.

  2. Put the cursor where you want to insert the character.

  3. Double-click the character (in the Character column) to insert.

    ASCII Insertion Panel

mbomb007
  • 743
  • 11
  • 24
  • 1
    @DavidPostill It's Notepad++, which is actually what I was searching for when I found this question. – mbomb007 Sep 24 '16 at 18:06
  • That doesn't help when the OP us using Notepad. – DavidPostill Sep 24 '16 at 18:08
  • 5
    @DavidPostill This isn't *for* the OP anymore. This is for users who find this question when searching. The OP got what he wanted years ago and deleted his account. Besides, [this answer](http://superuser.com/a/167309/494173) is also Notepad++ – mbomb007 Sep 24 '16 at 18:09
  • I found that this does not work if it is the start of a new line; have to type something and then double-click NULL, and then erase the first thing. Just some bug in Notepad++. – Abacus May 04 '20 at 15:18
  • 1
    @Abacus It works for me in the most recent version of Notepad++. Make sure you click on the character in the character column, not the Value or Hex. Otherwise, check the encoding of your file. – mbomb007 May 04 '20 at 16:59
  • @mbomb007 Absolutely correct! I'm sure I must have been clicking different columns and not noticing a distinction. The UI really should have a grid look if the different columns do different things, but c'est la vie. – Abacus Feb 08 '21 at 21:45
14

With Notepad++

From HEX

  1. Type 00 00 00
  2. Select this text
  3. TextFX > TextFX Convert > Convert Hex to text

From Base64

  1. Type AA==
  2. Select this text
  3. Plugins > MIME Tools > Base64 Decode

The mapping is:

NUL -> AA=
NUL NUL -> AAA=
NUL NUL NUL -> AAAA
alex2k8
  • 249
  • 2
  • 5
  • Your steps don't match your mappings. You say `AA==` in one place and `AA=` in another. – mbomb007 Sep 23 '16 at 18:26
  • 1
    Please read the question again carefully. Your answer does **not** answer the original question. The OP is using Notepad. – DavidPostill Sep 24 '16 at 20:06
  • 3
    @DavidPostill The OP asked for something that is impossible, so it's fine that he provide an alternative method of entering a NUL into a file. – mbomb007 Mar 09 '17 at 14:27
6

Normal text editors such as Notepad usually do not have the capability to enter NUL characters into files. What you probably want to do is to use a "hex editor" (some text editors also have a "hex" mode). This will let you enter NUL characters, or any other byte you might need.

Greg Hewgill
  • 5,499
  • 2
  • 29
  • 30