删除“ NUL”字符

我的笔记本 + + 里有这样的字符

npp screenshot of NULs

当我试图复制整行时,我实际上是在复制所有内容直到“ NUL”:

File:1

我想做的是,替换这些空值,变成空值,这样我就可以复制我的整行代码了。 也许有任何关键字可以告诉记事本 + + (或者其他可能有帮助的程序)来替换这些字符? 当我选择它,使用右键点击,然后“清除”,它走了-但我不想做一个接一个。

我不关心移除这个问题的原因,只关心效果(NULs)

226237 次浏览

This might help, I used to fi my files like this: http://security102.blogspot.ru/2010/04/findreplace-of-nul-objects-in-notepad.html

Basically you need to replace \x00 characters with regular expressions

enter image description here

Try Find and Replace. type \x00 in Find text box, check the Regular expression option. Leave Replace textbox blank and click on replace all. short cut key for find and replace is ctrl+H.

Highlight a single null character, goto find replace - it usually automatically inserts the highlighted text into the find box. Enter a space into or leave blank the replace box.

Click Search --> Replace --> Find What: \0 Replace with: "empty" Search mode: Extended --> Replace all

I tried to use the \x00 and it didn't work for me when using C# and Regex. I had success with the following:

//The hexidecimal 0x0 is the null character
mystring.Contains(Convert.ToChar(0x0).ToString() );


// This will replace the character
mystring = mystring.Replace(Convert.ToChar(0x0).ToString(), "");

Open Notepad++
Select Replace (Ctrl/H)
Find what: \x00
Replace with:
Click on radio button Regular expression
Click on Replace All

I was having same problem. The above put me on the right track but was not quite correct in my case. What did work was closely related:

  • Open your file in Notepad++
  • Type Control-A (select all)
  • Type Control-H (replace)
  • In 'Find What' type \x00
  • In 'Replace With' leave BLANK
  • In 'Search Mode' Selected 'Extended'
  • Then Click on 'Replace All'