             return .rollback
         }
         
-        // "'fooéı👨👨🏿🇫🇷🇨🇮'" is turned to Text
-        
-        try dbQueue.inTransaction { db in
-            try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: ["'fooéı👨👨🏿🇫🇷🇨🇮'"])
-            let sql = "SELECT realAffinity FROM `values`"
-            XCTAssertEqual(try DatabaseValue.fetchOne(db, sql)!.storageClass, .text)
-            try assertDecoding(db, sql, Bool.self, expectedSQLiteConversion: false, expectedDatabaseValueConversion: nil)
-            try assertDecoding(db, sql, Int.self, expectedSQLiteConversion:0, expectedDatabaseValueConversion: nil)
-            try assertDecoding(db, sql, Int32.self, expectedSQLiteConversion: 0, expectedDatabaseValueConversion: nil)
-            try assertDecoding(db, sql, Int64.self, expectedSQLiteConversion: 0, expectedDatabaseValueConversion: nil)
-            try assertDecoding(db, sql, Double.self, expectedSQLiteConversion: 0, expectedDatabaseValueConversion: nil)
-            try assertDecoding(db, sql, String.self, expectedSQLiteConversion: "'fooéı👨👨🏿🇫🇷🇨🇮'", expectedDatabaseValueConversion: "'fooéı👨👨🏿🇫🇷🇨🇮'")
-            try assertDecoding(db, sql, Data.self, expectedSQLiteConversion: "'fooéı👨👨🏿🇫🇷🇨🇮'".data(using: .utf8), expectedDatabaseValueConversion: "'fooéı👨👨🏿🇫🇷🇨🇮'".data(using: .utf8))
-            return .rollback
-        }
-        
-        // Blob is turned to Blob
-        
-        try dbQueue.inTransaction { db in
-            try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: ["'fooéı👨👨🏿🇫🇷🇨🇮'".data(using: .utf8)])
+        // emojiString is turned to Text
+        
+        try dbQueue.inTransaction { db in
+            try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: [emojiString])
+            let sql = "SELECT realAffinity FROM `values`"
+            XCTAssertEqual(try DatabaseValue.fetchOne(db, sql)!.storageClass, .text)
+            try assertDecoding(db, sql, Bool.self, expectedSQLiteConversion: false, expectedDatabaseValueConversion: nil)
+            try assertDecoding(db, sql, Int.self, expectedSQLiteConversion:0, expectedDatabaseValueConversion: nil)
+            try assertDecoding(db, sql, Int32.self, expectedSQLiteConversion: 0, expectedDatabaseValueConversion: nil)
+            try assertDecoding(db, sql, Int64.self, expectedSQLiteConversion: 0, expectedDatabaseValueConversion: nil)
+            try assertDecoding(db, sql, Double.self, expectedSQLiteConversion: 0, expectedDatabaseValueConversion: nil)
+            try assertDecoding(db, sql, String.self, expectedSQLiteConversion: emojiString, expectedDatabaseValueConversion: emojiString)
+            try assertDecoding(db, sql, Data.self, expectedSQLiteConversion: emojiData, expectedDatabaseValueConversion: emojiData)
+            return .rollback
+        }
+        
+        // emojiData is turned to Blob
+        
+        try dbQueue.inTransaction { db in
+            try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: [emojiData])
             let sql = "SELECT realAffinity FROM `values`"
             XCTAssertEqual(try DatabaseValue.fetchOne(db, sql)!.storageClass, .blob)
             try assertDecoding(db, sql, Bool.self, expectedSQLiteConversion: false, expectedDatabaseValueConversion: nil)

            try assertDecoding(db, sql, Int32.self, expectedSQLiteConversion: 0, expectedDatabaseValueConversion: nil)
            try assertDecoding(db, sql, Int64.self, expectedSQLiteConversion: 0, expectedDatabaseValueConversion: nil)
            try assertDecoding(db, sql, Double.self, expectedSQLiteConversion: 0, expectedDatabaseValueConversion: nil)
            try assertDecoding(db, sql, String.self, expectedSQLiteConversion: "'fooéı👨👨🏿🇫🇷🇨🇮'", expectedDatabaseValueConversion: "'fooéı👨👨🏿🇫🇷🇨🇮'")
            try assertDecoding(db, sql, Data.self, expectedSQLiteConversion: "'fooéı👨👨🏿🇫🇷🇨🇮'".data(using: .utf8), expectedDatabaseValueConversion: "'fooéı👨👨🏿🇫🇷🇨🇮'".data(using: .utf8))
            return .rollback
        }
    }

    }
}

private let emojiString = "'fooéı👨👨🏿🇫🇷🇨🇮'"
private let emojiData = emojiString.data(using: .utf8)
private let nonUTF8Data = Data(bytes: [0x80])

class DatabaseValueConversionTests : GRDBTestCase {
    
    private func assertDecoding<T: DatabaseValueConvertible & StatementColumnConvertible & Equatable>(
