As a simple example, consider the following string, where I can assign it to an sObject field and it retains the original value, but after inserting the sObject, the value returned when querying the record from the database is different:
String MyString = EncodingUtil.base64Decode('AEhlbGxvLCBXb3JsZCE=').toString();
Account a = new Account(Name = MyString);
System.assertEquals(MyString,a.Name);
insert a;
Account a2 = [SELECT Id, Name FROM Account WHERE Id = :a.Id LIMIT 1];
System.assertEquals(MyString,a2.Name);
Is there any way of knowing in advance whether a string has characters that will be dropped when saving them into a text field?
I would like to save the data so that it is displayed as text, and also be sure that I have it stored intact.