Community
    • 登入

    Fix corrupted txt file (NULL)

    已排程 已置頂 已鎖定 已移動 Help wanted · · · – – – · · ·
    corruptedfixtextnullfile
    116 貼文 39 Posters 189.2k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Christina ToumanidouC
      Christina Toumanidou
      最後由 編輯

      Hi guys
      I randomly found the best and easy solution. Just run the corrupted file to chrome, instad of null you will see the right code, then just the classic ctrl+u and you have again the code (if is html/css etc) eg for php cannot work for obvious reasons…

      BenB 1 條回覆 最後回覆 回覆 引用 0
      • redneck-f25R
        redneck-f25
        最後由 編輯

        Hello guys.

        Sorry for warming up this old thread. Don’t know if it is solved yet.

        I had the same problem (correct file size but only NULLs) on some embedded devices (Windows 10 Enterprise IoT 1607) with NPP and other (in-house) applications.

        When changing configuration files on the device using NPP, saving them and immediately power-cycle the device, sometimes the file is corrupted as described above. Sometimes the file (configuration) is written correctly but NPP schows NULLs when reopening. In that case closing and reopening that file shows the correctly saved content (It seems to me as only some NPP-chach is corrupted).

        Anyway, after disabling the write cache on the not-write-protected disk, everything went fine.

        So probably this is NOT an error caused and CANNOT be fixed by NPP.

        HOW TO: Manually Turn Disk Write Caching On or Off

        reg add "HKLM\SYSTEM\CurrentControlSet\Enum\<BUS>\<DISK_NAME>\<INSTANCE_ID>\Device Parameters\Disk" /v UserWriteCacheSetting /t REG_DWORD /d 0 /f && shutdown -r -t 0

        1 條回覆 最後回覆 回覆 引用 3
        • dontEatMeD
          dontEatMe
          最後由 編輯

          Hi, right now, i have same problem windows 7 x64 npp 7.5.9.
          Restored by previous version of file windows fuctionality.

          Eko palypseE Alan KilbornA Meta ChuhM 3 條回覆 最後回覆 回覆 引用 0
          • Eko palypseE
            Eko palypse @dontEatMe
            最後由 編輯

            @dontEatMe

            such issues are hard to track down, as you see it already took sometime before one
            found a reliable way to reproduce this issue but once found a possible fix can be coded.
            In order to help identifying/fixing such an problem it is needed to know what has been done,
            what happened and how is/was npp configured.
            And the best would be if you already know how to reproduce in a reliable way.

            1 條回覆 最後回覆 回覆 引用 2
            • Alan KilbornA
              Alan Kilborn @dontEatMe
              最後由 編輯

              @dontEatMe said:

              i have same problem windows 7 x64 npp 7.5.9.

              This is BAD as 7.5.9 supposedly fixed this problem!

              1 條回覆 最後回覆 回覆 引用 3
              • Meta ChuhM
                Meta Chuh moderator @dontEatMe
                最後由 編輯

                @dontEatMe

                if you say that some of your files got restored by previous versions of the same file using 7.5.9, some possible reasons are:

                • you have multi-instance enabled, and auto backup and periodic snapshot is enabled, and at one time you had the same file opened in 2 different instances without noticing it, where one of them was not saved, which is the version that will be restored, even though you saved the same file with newer contents at the other instance.

                • you have more than one notepad++ installed, eg. an installed one and a portable one, and auto backup and periodic snapshot is enabled, and you have modified the same file from both of them, and one of them was not saved and is restored from the snapshot that contains an older state.

                1 條回覆 最後回覆 回覆 引用 1
                • pnedevP
                  pnedev
                  最後由 編輯

                  @Alan-Kilborn said:

                  This is BAD as 7.5.9 supposedly fixed this problem!

                  The problem that was fixed was regarding the case you had backup turned on - in some cases a race condition occurred between backup operation and currently running action in the editor.

                  There is other possible problem connected with sudden power loss but I don’t think Notepad++ is to blame for this.

                  As @redneck-f25 said a few posts above:

                  Anyway, after disabling the write cache on the not-write-protected disk, everything went fine.
                  So probably this is NOT an error caused and CANNOT be fixed by NPP.

                  1 條回覆 最後回覆 回覆 引用 4
                  • Summer BeginS
                    Summer Begin
                    最後由 編輯

                    Just happened to me. Can’t even recover with the recovery software. It appears notepad++ need to improve the way it saves data, i.e. do not remove the copy of overwritten file until the saving is successful. (I was using one or two version before Notepad++ v7.7.1, have now upgraded though so can’t tell which version it was)

                    1 條回覆 最後回覆 回覆 引用 2
                    • Alex BarkerA
                      Alex Barker
                      最後由 編輯

                      Glad to see this is still an issue 3 years after being reported. I just ran into this problem when saving and then closing the laptop lid that initiated a reboot because how else is Windows suppose to destroy your data. I will be taking this opportunity to never use notepad++ again. Thanks.

                      1 條回覆 最後回覆 回覆 引用 2
                      • Afroja NoonA
                        Afroja Noon
                        最後由 編輯

                        I am sorry to say that I cannot tell you a way to fix the corrupted files. But what I can tell you is this isn’t npps fault,
                        The culprit is Windows itself. Turn this off to avoid future losses. I lost my 7 days of work to this.
                        ![The culprit](6e1d09b6-f495-4cd5-91d0-4cc3badf811e-image.png image url)
                        The solution:
                        ![Solution](007a186c-4e3a-4331-8d1a-72507d93e965-image.png image url)

                        pnedevP 1 條回覆 最後回覆 回覆 引用 5
                        • pnedevP
                          pnedev @Afroja Noon
                          最後由 編輯

                          @Afroja-Noon ,

                          You are right, although Notepad++ can use the appropriate Windows APIs to flush the write cache when saving and circumvent this.
                          The common user is not obliged to know such details and deal with system configuration nonsense before doing a simple text editing.
                          If I were an uninformed user and lost my saved data edited in Notepad++ I would loose trust in the editor too.

                          BR

                          PeterJonesP 1 條回覆 最後回覆 回覆 引用 5
                          • PeterJonesP
                            PeterJones @pnedev
                            最後由 編輯

                            @pnedev said in Fix corrupted txt file (NULL):

                            although Notepad++ can use the appropriate Windows APIs to flush the write cache when saving and circumvent this.

                            @pnedev, were those the changes you have committed as referenced in #6133? Were any or all of those changes incorporated into the codebase? (I see that #6164 was closed, but more changes were made after that, so I’m not sure the rest of your fixes were ever incorporated.)

                            pnedevP 1 條回覆 最後回覆 回覆 引用 0
                            • pnedevP
                              pnedev @PeterJones
                              最後由 pnedev 編輯

                              Hi @PeterJones,

                              Yes, https://github.com/notepad-plus-plus/notepad-plus-plus/pull/6164 is the PR that should fix this problem but as Don decided to reject it it is not merged but simply closed.
                              The later changes perhaps appear because of the patch re-bases in my Npp code clone (https://github.com/pnedev/notepad-plus-plus/commit/5397cd9030fbc23265b4d409e4c61c59ab1c8887).
                              This is because I have mentioned the issue numbers in the commit message.

                              BR

                              1 條回覆 最後回覆 回覆 引用 3
                              • Siulfer MosqueiraS
                                Siulfer Mosqueira
                                最後由 編輯

                                I solved my corrupt file with Recuva software after a blue screen in windows, I followed the instructions in the following post: https://superuser.com/questions/377904/recover-file-corrupted-due-to-power-cut-off and voila!! Thanks

                                corrupt_file_null.jpg

                                1 條回覆 最後回覆 回覆 引用 2
                                • BenB
                                  Ben @Christina Toumanidou
                                  最後由 編輯

                                  @Christina-Toumanidou Nope. Doesn’t work.

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • BenB
                                    Ben
                                    最後由 編輯

                                    This issue is STILL happening in 2020 under NotePad++ 7.8.5 ! We just had a power outage and upon reboot everything was fine (11 open files) except for the current file I was working on. I just lost 5 hours of work. I hit CTRL-S almost every 10 seconds when developing. 163KB code file filled with NUL characters, this is insane!

                                    For the record:

                                    • Backup on save was set to “None”.

                                    Here’s what NotePad++ shows when opening the file:

                                    asd1.PNG

                                    Here’s what Recuva gave me, absolutely useless. F*** !!!

                                    asd2.PNG

                                    I cannot believe this is happening to me right now. 5 hours of work destroyed for no reason. This isn’t 1991 anymore. WTF?

                                    EkopalypseE PeterJonesP 2 條回覆 最後回覆 回覆 引用 2
                                    • EkopalypseE
                                      Ekopalypse @Ben
                                      最後由 編輯

                                      @Ben said in Fix corrupted txt file (NULL):

                                      Backup on save was set to “None”.

                                      But session snapshot and periodic backup is set?
                                      If so, then it might be that the real files are still valid and
                                      only the temporary files have been corrupted.

                                      I hit CTRL-S almost every 10 seconds when developing

                                      Which then can mean, that your data loss is only for the last ten seconds.

                                      Alan KilbornA 1 條回覆 最後回覆 回覆 引用 0
                                      • Alan KilbornA
                                        Alan Kilborn @Ekopalypse
                                        最後由 Alan Kilborn 編輯

                                        @Ekopalypse

                                        OP said:

                                        I hit CTRL-S almost every 10 seconds when developing

                                        Doesn’t this imply that the user is working with a file that is NOT subject to periodic backup, but only subject to backup-on-save?
                                        My understanding is that only unnamed files are subject to the periodic backup.

                                        But then OP says

                                        backup-on-save was None.

                                        So to me this means that there was only ONE version of the file, and if it is corrupted, then, well, sadly, there isn’t anything to recover.

                                        This also says to me that there is still a data-loss problem with Notepad++…

                                        EkopalypseE 1 條回覆 最後回覆 回覆 引用 1
                                        • EkopalypseE
                                          Ekopalypse @Alan Kilborn
                                          最後由 Ekopalypse 編輯

                                          @Alan-Kilborn said in Fix corrupted txt file (NULL):

                                          Doesn’t this imply that the user is working with a file that is NOT subject to periodic backup, but only subject to backup-on-save?
                                          My understanding is that only unnamed files are subject to the periodic backup

                                          No, Npp creates for every unsaved file a backup.

                                          backup-on-save was None.

                                          Is just an additional option, afaik.

                                          Alan KilbornA 1 條回覆 最後回覆 回覆 引用 0
                                          • Alan KilbornA
                                            Alan Kilborn @Ekopalypse
                                            最後由 Alan Kilborn 編輯

                                            @Ekopalypse said in Fix corrupted txt file (NULL):

                                            Npp creates for every unsaved file a backup.

                                            I don’t find this to be true.
                                            Change my mind! :-)

                                            But start with a definition of “unsaved file” because this is ambiguous and could mean either:

                                            • a file that has never been user-saved, and typically has a name like “new 3” for example, but could be renamed (without disk-saving) by the user
                                            • a file that has been user-saved (to disk) at least once, but currently is modified/dirty (red disk icon)
                                            EkopalypseE 1 條回覆 最後回覆 回覆 引用 2
                                            • 第一個貼文
                                              最後的貼文
                                            The Community of users of the Notepad++ text editor.
                                            Powered by NodeBB | Contributors