MapInfo Pro

 View Only
Expand all | Collapse all

Notepad++ wor files potential issue

  • 1.  Notepad++ wor files potential issue

    Posted 03-21-2019 12:23
    ​Does anyone else use notepad++ to bulk edit .wor files and has anyone had occurrences where the edited files have corrupted.
    Today I updated 200 plus files using the editor and I noticed some of them are corrupted.

    I wondered if it might be just some of the files which have been opened in MIPro 17 as opposed to older workspaces but in fact it seems they are all from the same date and have not been edited in v17.

    Notepad++ is set to auto-detect encoding and its encoding is set to UTF-8.

    Anyone else experience something similar?


    ------------------------------
    Martin Dowler
    CHESHIRE & WIRRAL PARTNERSHIP NHS TRUST
    ------------------------------


  • 2.  RE: Notepad++ wor files potential issue

    Posted 03-22-2019 05:31
    Hi Martin,

    I sometimes use NPP for this task, but haven't encountered problems to date. Could you give some more detail - what version of NPP you are using for example, and the nature of the corruption?

    Cheers,

    Andy

    ------------------------------
    Andrew Harfoot
    GeoData
    University of Southampton
    ------------------------------



  • 3.  RE: Notepad++ wor files potential issue

    Posted 03-22-2019 05:41

    Hello,

     

    I think I know what the problem is as it's hit me on a number of occasions. You may have been hit by the "BOM"... the Byte Order Mark. These are a sequence of three values which are placed at the beginning of a text file as a magic number to indicates that it's UTF-8 encoded. The problem is, however, if the software loading the file doesn't handle the BOM, it will appear as a corrupted file. Notepad++ can handle files which start with the BOM, but there's little to tell you it's there.

     

    To check if this is your problem, open one of the problematic WOR files in Notepad++ then go to the Encoding menu and see if you have "Encode in UTF-8 BOM" selected. If so, switch to ANSI or straight UTF-8 and you should be fine.

     

    As we drag legacy software to the modern age with Unicode character encoding, I suspect BOM issues with increase.

     

    https://en.wikipedia.org/wiki/Byte_order_mark

     

    Regards,

    Warren Vick

    Europa Technologies Ltd.

     






  • 4.  RE: Notepad++ wor files potential issue

    Employee
    Posted 03-22-2019 07:04
    MIPro 15.2 (x64) & later has a system settings preference to encode workspaces and tab files.  If that is checked then workspaces (and new TAB files) will be encoded as UTF-8 with BOM.  This preference is unchecked by default so uses can share non-Unicode WOR\TAB files with earlier MIPro versions provided they aren't using newer features in them.  FYI, MIPro writes to lowest possible version depending on features used (new MB syntax, new Projection or Datum#, etc.)
    If editing & saving in NP++ then make sure you are encoding them (UTF-8 BOM) same way else you can corrupt these WOR\TAB files as well. 
    All that being said, manual editing of workspaces is always done at user's peril even though they contain only uncompiled MB syntax.

    Cheers,
    -Bill

    ------------------------------
    Bill Wemple
    Principal QA Engineer
    Pitney Bowes
    Troy, NY
    ------------------------------



  • 5.  RE: Notepad++ wor files potential issue

    Posted 03-22-2019 07:18

    ​​It was worth a shot but I tried it and it didn't solve it Warren. There are about 8 files, all with the same modified date/time and 6 of them are corrupt. They were all bulk saved in NPP. I cant be sure which version of NPP it happened in either as I have different versions on the pc's I use (my work one is v7/32bit but the other is more recent). I think I may have to put it down to a blip. On the plus side all the files were template files, not actual project files so I can recreate them fairly easily. I was just worried that as I wanted to bulk edit a couple of hundred files I might be spreading corruption across my file structure like a virus. Also that is really useful to know too Bill. Thanks all.



    ------------------------------
    Martin Dowler
    CHESHIRE & WIRRAL PARTNERSHIP NHS TRUST
    ------------------------------



  • 6.  RE: Notepad++ wor files potential issue

    Posted 03-22-2019 08:14
    As far as I'm aware NPP shouldn't add (or remove) a BOM unless this is requested by the user, ie the encoding of a file that already exists is preserved. New files created in NPP default to UTF-8 without BOM, but this can be adjusted in the settings.

    What is the nature of the corruption Martin? How do the corrupt files appear in NPP? If you have access to the original files, or can reconstruct them, can you use the NPP Compare plugin to highlight the differences before and after the changes (note that this will not detect BOM related differences)?

    ------------------------------
    Andrew Harfoot
    GeoData
    University of Southampton
    ------------------------------



  • 7.  RE: Notepad++ wor files potential issue

    Posted 03-22-2019 09:06
      |   view attached
    ​I've attached a screenshot of one of the files. I don't think I have earlier versions of the files.

    ------------------------------
    Martin Dowler
    CHESHIRE & WIRRAL PARTNERSHIP NHS TRUST
    ------------------------------



  • 8.  RE: Notepad++ wor files potential issue

    Posted 03-22-2019 10:15
    Ok, that's way beyond BOM issues! I can't say I've ever seen anything like this happen with NPP - it looks as though a binary file has been copied over the original WOR, though not any of the standard MI Tab component files.

    ------------------------------
    Andrew Harfoot
    GeoData
    University of Southampton
    ------------------------------



  • 9.  RE: Notepad++ wor files potential issue

    Posted 03-22-2019 10:29

    Hello Martin,

     

    Sorry to hear that but it was worth a shot.

     

    The next thing to look at is the exact nature of the issue. Does the offending WOR crash Pro or give an error message? What did you change using Notepad++? Was it a universal/all-file change that might have damaged something accidently?

     

    As Andrew mentioned, use of a compare function might be revealing, otherwise it may be something else encoding related. I discovered the BOM issue after resorting to a hex editor to look at my problematic files (https://www.hhdsoftware.com/free-hex-editor).

     

    Regards,

    Warren Vick

     






  • 10.  RE: Notepad++ wor files potential issue

    Posted 03-22-2019 11:19
    ​I thought that but the strange thing is that out of 16 files with same modified timestamp on them most are corrupt but some aren't. MIPro shows an error message: File is not a valid table, workspace or application.

    ------------------------------
    Martin Dowler
    CHESHIRE & WIRRAL PARTNERSHIP NHS TRUST
    ------------------------------



  • 11.  RE: Notepad++ wor files potential issue

    Posted 03-23-2019 06:02

    Hi Martin,

     

    If they're not confidential, please e-mail me an example of a working and a broken WOR. I don't need any TAB files referenced within them. I'd be happy to try and figure out what's happened.

     

    Regards,

    Warren Vick