Strange formatting in variable output to gmail...help!

Dec 14, 2020

Hello!

I am trying to output an essay question to email... but whatever I try I get every space and line break as a %20 between the words.

Could someone please give me a hand with this? Please...

The file is below.

This is the code I've patched together (I'm not a programmer):

var player=GetPlayer();

var name=player.GetVar("Student_Name");

var topic_one=player.GetVar("EssayQuestion");

topic_one = topic_one.replace(/\r\n?/g, '%0D%0A');

var email=player.GetVar("Email_Input_Student");

var cc=player.GetVar("Email_Input_Teacher");

var subject="Writing Tasks"+name;

var body=topic_one;

//NEW LINE
body = body.replace(/\r\n?/g, '%0D%0A');

var link='mailto:'+email+
'?subject='+subject+
'&cc='+cc+
'&body='+body;

window.open(link);

2 Replies
Maria Costa-Stienstra

Hello, MarkAnthony,

I want to try to replicate your error as best as possible - which email client are you using (you mentioned gmail, but I am not sure if you are going through a browser or through their app)?

I published your story and tried both Windows Mail and Gmail (through firefox - see attachment), and both times the spaces were there without the %20 between the words. It looks like it's working as intended for me, but I want try to help figure out what's happening on your end :)

Regards,

Maria