Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: (SOLVED) BUG: Descriptions file cannot be edited  (Read 2774 times)

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
(SOLVED) BUG: Descriptions file cannot be edited
« on: May 13, 2015, 10:38:27 PM »

When you open the descriptions.csv file in either notepad or open office you immediately notice that there isn't a comma between "notes" and the first ID of the first description.

The game will run fine if you do not edit it at all, but even pressing enter will break the file completely. Pressing backspace to fix your "mistake" does not help either. You will continually get the FATAL:JSONObject: ["id"] not found error message. So far all I have been able to do to fix the problem is to re-download the game each time.

It must be something from the latest patch because I have always been able to edit the file in the past... come to think of it I think I had to scrap my old descriptions file when the trade update hit. At the time I thought there was just a format change and I would get back to it later... could even be from way back then.

Anyway I will start experimenting more with it to see if I can find out some more info but it looks like there is something weird there that doesn't apply to any of the other csv files such as ships.csv or weapons.csv.

Those seem to be far more flexible in how you can edit them. I have consistently edited them even with the new update using both notepad and open office.

EDIT: Actually all of those files don't have a comma after the end of the descriptor first line and before the first actual data line either.. seems strange to me  :P but those seem to work ok. Looks like it is simply an issue with any space or editing at all of the  descriptions file. I tried just putting a simple space in between the last comma of a line and the id of the next line and it breaks it the same way.  :-\
« Last Edit: May 14, 2015, 02:28:45 PM by Morrokain »
Logged

Pushover

  • Captain
  • ****
  • Posts: 292
    • View Profile
Re: BUG: Descriptions file cannot be edited
« Reply #1 on: May 14, 2015, 01:36:44 AM »

I think this is an issue with a lot of editors that replace the line endings with their own characters. When you save, it converts all the newline characters to a different set of newline characters, and this seems to break the json parser.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: BUG: Descriptions file cannot be edited
« Reply #2 on: May 14, 2015, 10:46:33 AM »

Yeah, this is definitely an issue with whatever editor you're using.

(There's no comma at the end of the first line, but there doesn't need to be.)
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: BUG: Descriptions file cannot be edited
« Reply #3 on: May 14, 2015, 02:10:25 PM »

Yeah, this is definitely an issue with whatever editor you're using.

Even notepad? I could see it being an open office issue certainly since free software usually have these hiccups... but notepad is so basic. And why would it only break descriptions and not all the csv files? Just seems weird to me. Also the funny thing is that if I open the base file (that works) in notepad and then open my own file (that doesn't work) or even a former base file that I just press a key, delete it, and save (also doesn't work) they look exactly the same. Anything else in the game can that can be modified can be edited in notepad just fine. Why would descriptions be any different and why has this changed only now? It worked fine before.  ???

I will somehow try to correct the issue... maybe Ill just uninstall open office, redownload the game, edit it in notepad+ or something and see if that solves it.

(yeah i figured the comma thing was irrelevant because all of those files do that and thats just because it is only relevant to the observer not to the the data itself lol silly me I jumped to conclusions there for sure  ::) )

EDIT: Solved... yup definitely issues with both notepad and openoffice. However, wordpad does the job just fine. You can even edit it in notepad or open office first, you just have to open it in wordpad and click save and it runs fine. Definitely something behind the scenes here but a decent fix for now as I think all computers come with wordpad.
« Last Edit: May 14, 2015, 02:29:43 PM by Morrokain »
Logged

orost

  • Captain
  • ****
  • Posts: 436
    • View Profile
Re: BUG: Descriptions file cannot be edited
« Reply #4 on: May 14, 2015, 02:38:15 PM »

Morrokain: the broken and the working files look the same, because the problem probably lies in line terminators, which can be encoded in different ways but always look the same. Notepad is a very Windows-centric and unsophisticated program that will save a file with CRLF terminators regardless of what kind it had originally, so it may corrupt files that with CR terminators meant to be read by parsers that expect CR terminators.

Any other text editor should be smart enough to not mess that up. So just don't use Notepad and it should be fine. Really, "don't use Notepad" is pretty much universal advice.

For most .csv files, the best editor is actually a spreadsheet program like Calc or Excel, try that.
« Last Edit: May 14, 2015, 02:39:59 PM by orost »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: (SOLVED) BUG: Descriptions file cannot be edited
« Reply #5 on: May 14, 2015, 03:09:14 PM »

It's not actually an end of line issue. For some reason notepad sticks a few extra characters at the beginning of that file on saving; not sure why. It could be a BOM, but the game should in theory read a file with a BOM just fine. I haven't really looked into it that deeply, so I can't say, but suffice it to say, Notepad tries to do something "smart" and it comes out about as well as you'd expect.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: BUG: Descriptions file cannot be edited
« Reply #6 on: May 14, 2015, 03:51:22 PM »

Any other text editor should be smart enough to not mess that up. So just don't use Notepad and it should be fine. Really, "don't use Notepad" is pretty much universal advice.

For most .csv files, the best editor is actually a spreadsheet program like Calc or Excel, try that.

Noted.  :)

I have heard notepad+ is better and will do its best to highlight syntax anyway so I should probably upgrade.

Open office is a free program that mimics microsoft office. Its not the best (as it is free) but has always handled the csv files fine.. until this one apparently.

Trust me the only time I edit csv files like ships or weapons in notepad is when I want to copy a line as it is pretty fast at doing that. The rest of the time I use the open office spreadsheet editor. For whatever reason descriptions.csv is being finicky about that one too.

C'est la vie  8)

At least there is an easy solution so I'm not too worried about it.
Logged