TowelSniffer / Anki-Chess-2.0

An interactive chess template for anki.
GNU General Public License v3.0
104 stars 11 forks source link

Truncated output after ampersand #10

Closed ExtremeCoolDude closed 3 years ago

ExtremeCoolDude commented 3 years ago

This will result in pegparser syntax error :

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]
[ECO "E14"]

1. d4 d5 2. Nf3 { Here black & white look good } 

console.log(pgn) :

image

Everything after & character is truncated. Not sure what's causing it

TowelSniffer commented 3 years ago

So with URL variables they are separated by an ampersand, so Its no surprise having an ampersand in the pgn will cause an error. The only way I can think to fix it is to replace it with something else and then re-replace it in the html files. Kind of dirty but what can you do.

I will check to see if other characters trip it, like an Equals sign perhaps

TowelSniffer commented 3 years ago

Ok so a clean solution exists. Simply encodeURIComponent instead of encodeURI solves this. this is what I get for trying to use code without reading what it actually does

TowelSniffer commented 3 years ago

fixed