PGN - Comment including the } char
Posted: Fri Jan 11, 2019 3:17 pm
The PGN standard says:
"Comment text may appear in PGN data. There are two kinds of comments. The
first kind is the "rest of line" comment; this comment type starts with a
semicolon character and continues to the end of the line. The second kind
starts with a left brace character and continues to the next right brace
character. Comments cannot appear inside any token.
Brace comments do not nest; a left brace character appearing in a brace comment
loses its special meaning and is ignored. A semicolon appearing inside of a
brace comment loses its special meaning and is ignored. Braces appearing
inside of a semicolon comments lose their special meaning and are ignored."
There is a problem with comments containing right brace } characters.
I can think about a few workarounds:
1) Simply remove } characters from comments
2) Replace } characters with normal )
3) Replace } characters with } and restore } to } when a PGN is opened.
I kind of like the idea of using the HTML entity } because it is transparent for the user, which can re-open the PGN and see his comment unchanged. However the PGN will somehow lose in portability because in other programs the } will not be restore to }.
Which workaround do you think is the best one? Other ideas?
"Comment text may appear in PGN data. There are two kinds of comments. The
first kind is the "rest of line" comment; this comment type starts with a
semicolon character and continues to the end of the line. The second kind
starts with a left brace character and continues to the next right brace
character. Comments cannot appear inside any token.
Brace comments do not nest; a left brace character appearing in a brace comment
loses its special meaning and is ignored. A semicolon appearing inside of a
brace comment loses its special meaning and is ignored. Braces appearing
inside of a semicolon comments lose their special meaning and are ignored."
There is a problem with comments containing right brace } characters.
I can think about a few workarounds:
1) Simply remove } characters from comments
2) Replace } characters with normal )
3) Replace } characters with } and restore } to } when a PGN is opened.
I kind of like the idea of using the HTML entity } because it is transparent for the user, which can re-open the PGN and see his comment unchanged. However the PGN will somehow lose in portability because in other programs the } will not be restore to }.
Which workaround do you think is the best one? Other ideas?