Fixing the Issue when building for Android using compress_kernels=1 and python 3

Resolves COMPMID-4759

Signed-off-by: Adnan AlSinan <adnan.alsinan@arm.com>
Change-Id: Iaa37c63682bbf900e42195f52f5264ea565cc46e
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6059
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Comments-Addressed: Gunes Bayir <gunes.bayir@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
diff --git a/SConscript b/SConscript
index 2f43e39..2eed75a 100644
--- a/SConscript
+++ b/SConscript
@@ -25,6 +25,7 @@
 import subprocess
 import zlib
 import json
+import codecs
 
 VERSION = "v0.0-unreleased"
 LIBRARY_VERSION_MAJOR = 24
@@ -136,7 +137,8 @@
         with open(file[1].target_name.get_path(), 'w+') as out_file:
             file_to_write = "\n".join( file[1].file_contents )
             if env['compress_kernels']:
-                file_to_write = zlib.compress(file_to_write, 9).encode("base64").replace("\n", "")
+                file_to_write = zlib.compress(file_to_write.encode('utf-8'), 9)
+                file_to_write = codecs.encode(file_to_write, "base64").decode('utf-8').replace("\n", "")
             file_to_write = "R\"(" + file_to_write + ")\""
             out_file.write(file_to_write)