licence: show file causing read exception

License script fails if attempting to read an UTF-8 encoded file
as it expects pure ASCII. With this change the script opens sources
files decoded as UTF-8 and no longer breaks on above condition.

Change-Id: I7645ce9ffbfac143777f53f5f00e3e7063142494
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/build/license.py b/build/license.py
index 545eb29..9fa0dc7 100644
--- a/build/license.py
+++ b/build/license.py
@@ -35,8 +35,13 @@
     header += "\n */" if args.style == "c" else ""
     header += "\n\n"
     header_regex = re.escape(header).replace(year, r"\d\d\d\d")
-    with open(args.file, "r") as f:
-        contents = f.read()
+    with open(args.file, "rb") as f:
+        try:
+            contents = f.read().decode('utf-8', 'strict')
+        except Exception as ex:
+            print("Failed reading: " + args.file +
+                " (" + ex.__class__.__name__ + ")")
+            return
         if re.search(header_regex, contents):
             return
     with open(args.file, "w") as f: