diff --git a/Code.gs b/Code.gs index 66bde0c..a4c8a7f 100644 --- a/Code.gs +++ b/Code.gs @@ -192,6 +192,15 @@ function makeAndroidString(object, textIndex, options) { exportString += "\t" + '' + "\n"; prevIdentifier = ""; } + + if(typeof text === 'string') { + text = text.replace(/\n/g, "\\n"); + text = text.replace(/&/g, "&"); + text = text.replace(/\'/g, "\\'"); + text = text.replace(//g, ">"); + text = text.replace(/"/g, "\\\""); + } if(identifier.indexOf("[]")>0) { @@ -199,7 +208,7 @@ function makeAndroidString(object, textIndex, options) { exportString += "\t" + '' + "\n"; } - exportString += "\t\t"+''+o.text+'' + "\n"; + exportString += "\t\t"+''+text+'' + "\n"; prevIdentifier = identifier; } else { @@ -261,6 +270,10 @@ function makeIosString(object, textIndex, options) { continue; } + if(typeof text === 'string') { + text = text.replace(/"/g, "\\\""); + } + exportString += '"' + identifier + '" = "' + text + "\";\n"; }