def encodeStringValues(self, record, encoding):
        """ This function encodes string values in a record in the encoding
        of the SPSS data file. """
        encodedRecord = []
        for value in record:
            if isinstance(value, str):
                try:
                    value = value.decode(self.fileEncoding, "replace").encode(encoding)
                except UnicodeEncodeError:
                    value = value.decode(self.fileEncoding, "replace").encode("UTF-8")
            encodedRecord.append(value)
        return encodedRecord
 This function encodes string values in a record in the encoding
        of the SPSS data file. 
recipes/Python/577650_Python_reader_for_spss_sav_files/recipe-577650.py