Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Problem with Text Export

Tygur
2005-04-08
2012-09-17
  • Tygur
    Tygur
    2005-04-08

    The way Password Safe exports to text files right now just seems....bad. It doesn't account for all the possibilities in the Notes field. Specifically, if there is a double-quote character, all bets are off, because no way of escaping them is provided.

    Why not escape them somehow? (" can become "", or even \", for example) While you're at it (if you feel like it, of course) why not escape carriage return and linefeed characters, so that each entry always takes exactly one line? I'd imagine that this would make importing much easier. I've gotten into the habit of using \ as an escape character, much like how it's used in string literals of popular C-based languages.

    I'm posting here out of frustration from trying to write a program that reads these text export files. At this point, I'd even be willing to try writing some code, but I'm not sure that's such a good idea, because I'm not all that familiar with Password Safe's code.

     
    • Tygur
      Tygur
      2005-04-09

      Ok, I've finished the portion of my app that reads these files, and I'm quite satisfied. Instead of looking for the terminating double-quote character for the notes, it looks ahead and sees if the next line has at least 3 tab characters. If so, it assumes that this line is the last line for this entry, and a new entry starts on the next one.

      The only two conditions I know of that would make this not work is if the notes had 3 or more tabs on any line but the first one, or if there are any blank lines. Since the only way you can get a tab into the notes is by pasting it in from somewhere else (you can't just type it in), I don't expect them to have too many of them. And as for the blank lines, I thankfully have yet to see Password Safe put any in.