Handling unknown characters in Blob.setDataFromString with encoding

Home / Uncategorized / Handling unknown characters in Blob.setDataFromString with encoding

Question:
I have a Google Add-On which will export sheet data in a defined encoding. The most common encoding used is ISO-8859-1. The script creates an internal String, then runs:Utilities.newBlob("", null, filename).setDataFromString(propClob, defEncoding);
If the original data contains a character which cannot be represented in ‘defEncoding’, the resulting Blob will contain a ‘?’. I’d like to replace the character with its Unicode expression instead, eg. u0105.
How can I check a string for characters not present in a given encoding?
How can I find the Unicode expression for a given UTF-8 character?

Thanks, Simon


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *