Open adbennet opened 4 years ago
I am also having this issue. This can be rather frustrating as most PGNs from online chess come with at least one comment these days, it seems. The fix should be simply respecting the brackets currently present where they are, or adding comment logic to the software itself.
Example PGN corruption:
When loaded:
1. e3 { A00 Van't Kruijs Opening } e5 2. Nf3 Nc6 3. Bb5 a6 4. Bxc6 dxc6 5. Nxe5 Qd5 6. Nf3 Bd6 7. O-O Nf6 8. Nc3 Qh5 9. e4 Bg4 10. h3 O-O 11. hxg4 Nxg4 12. Ne2 Bh2+ 13. Kh1 Bd6+ 14. Kg1 Bh2+ 15. Kh1 Bd6+ 16. Kg1 { The game is a draw. } 1/2-1/2
After Save:
1. e3 A00 Van't Kruijs Opening 1... e5 2. Nf3 Nc6 3. Bb5 a6 4. Bxc6 dxc6 5. Nxe5 Qd5 6. Nf3 Bd6 7. O-O Nf6 8. Nc3 Qh5 9. e4 Bg4 10. h3 O-O 11. hxg4 Nxg4 12. Ne2 Bh2+ 13. Kh1 Bd6+ 14. Kg1 Bh2+ 15. Kh1 Bd6+ 16. Kg1 The game is a draw. 1/2-1/2
I wrote a python script to run after you are done with the app to fix any missing brackets. I might not work in every case, but it works in my cases: https://gist.github.com/turnipsoup/6d984ae077d6cf09e81177559b79ba1e
Starting from a valid PGN file with {bracketed comments}, opening in Stockfish and then saving it, Stockfish removes all the "{" and "}" in all the games, rendering the PGN invalid. See the attachment for a minimal before and after example.
Steps to reproduce: $ cp test0.pgn test1.pgn $ cp test0.pgn test2.pgn
Stockfish
Stockfish
$ pgn-extract -r -s test0.pgn $ pgn-extract -r -s test1.pgn No knight move possible to g7. File test1.pgn: Line number: 11 Failed to make move 2... Nxg7+ in the game: .q.k...r .p.nb.Np pB....b. N...p.P. r....... ..Q..... PPP..... ..KR.R..
[big snip/]
Stockfish Version 2.2.3 (31) MacBookAir9,1 macOS Catalina Version 10.15.7 test-Stockfish-Save-pgn.zip