Categories > TinyButStrong general >

Escaping base64 String

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Cozen
Date: 2016-04-14
Time: 10:05

Escaping base64 String

Hi,
I would like to know the best way to escape a full string (in my case it's a base64 img (which is very long)).
I saw that you can use a double simple quote '' but is there a way to escape the string without altering it ?
It take some much time if I have to do it manually.
In my exemple :
[table_7_4.0.field_19.0.field_1;if [val]=="Ensoleillée";then <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAB1ElEQVRoQ+3Z4U3DMBAF4NcJgE0YAUZgA5gMRmADGIFNgAlAh2oUuY3z3t3ZqiLnt3P25+c4jXvAzq7DzjyYoEtPdCY0Exo8A3PJAbgF8AbgGsATgJfkEB4BPAP4AnAP4EOprya0xJR+MlEFU2rLKAV0DpOJqjFL1AOAdyYpFtTCZKDWMEsDtRIYEIOJoBhMqW9JvbaSYkCfxw2ASdzaUDN5LKZg7BZ7pm6ioB9WsmjHoFRMKd8MgUnI23EL1aPmH5gBWbvMAWTWOlk8LCgL1RWjJFRmIjIgq2G/ANSLeR7/ayoJRVEqRN0xpWeoHow3KQUlJUNtgRu990S5MJ5naERSbkwGKLL7nVsAIUwWKAsVxmSCoqgUzAQ1dr2MHS8lJc+LtedOF0ZFQRnJ1BMUQkVAPTAF50Z5QT0xIZQHNALjRqkgL8aWkF0X9fkQwZTT1Ywazd/MbEKZA8msdYJjQD0G0KMm/YG3u2MsO9y7Ej41lXeImtT31qEns+TsKNgOyhmUglHPKAxzt/X3CgOyjhmUB8OiKIz6+dBCRTBbKBqjgtaSysCsoSSMB1SjMjE1SsZ4QcKGN74puymMH5mzxwlyTtyw22ZCw6ba2dFMyDlxw277BWOYeDV9EH2oAAAAAElFTkSuQmCC" width="22" height="22">;else '']
If my img is not in a tbs statement then it is display very well !
But, in this case, it is not.
Obviously, the 'then' statement have some hard time to encapsulate this string entirely, that's why I ask for escaping method.
Thanks for the help.

By: Skrol29
Date: 2016-04-14
Time: 15:33

Re: Escaping base64 String

Bonjour Cozen,

In parameters, values can be delimited by single quotes (not double), and single quotes are escaped by using it twice.

But for more comfortable usage, you can use a TBS fiels with parameter "magnet" that is placed near the <img> element instead of placing the <img> inside the TBS field.
Parameter "magnet" can be enhanced using parameter "ope=minv", "ope=mok", ...
By: Cozen
Date: 2016-04-14
Time: 15:40

Re: Escaping base64 String

Hi,
Thanks for the replay.
I already know magnet nevertheless I figure out now that can be very useful.
I found another solution with HTML documents : use TBS to add class and for exemple hide or show the img.