UnicodeDecodeError: 'utf-8' codec can't decode byte

Do you see this error when trying to compile (run a build) after importing source code into VS Code for IBM i?

build error for special characters in vs code for ibm i
Running Action: /QOpenSys/pkgs/bin/makei build (11:44:09 AM)
Working directory: /home/projex/builds/Projex4i.V7400
Commands:
/QOpenSys/pkgs/bin/makei build

Traceback (most recent call last):
File "/QOpenSys/pkgs/lib/bob/src/makei/cli/makei_entry.py", line 293, in <module>
cli()
File "/QOpenSys/pkgs/lib/bob/src/makei/cli/makei_entry.py", line 41, in cli
args.handle(args)
File "/QOpenSys/pkgs/lib/bob/src/makei/cli/makei_entry.py", line 254, in handle_build
build_env = BuildEnv([target], args.make_options, get_override_vars(args))
File "/QOpenSys/pkgs/lib/bob/src/makei/build.py", line 65, in __init__
self._create_build_vars()
File "/QOpenSys/pkgs/lib/bob/src/makei/build.py", line 85, in _create_build_vars
rules_mk = RulesMk.from_file(rules_mk_path, self.src_dir, map(Path, self.iproj_json.include_path))
File "/QOpenSys/pkgs/lib/bob/src/makei/rules_mk.py", line 185, in from_file
rules_mk = RulesMk.from_str(rules_mk_str, rules_mk_path.parent, src_dir, include_dirs)
File "/QOpenSys/pkgs/lib/bob/src/makei/rules_mk.py", line 264, in from_str
is_text_defined = RulesMk._find_source_member_text(source_location)
File "/QOpenSys/pkgs/lib/bob/src/makei/rules_mk.py", line 284, in _find_source_member_text
metadata_comment_exists = check_keyword_in_file(file_path, METADATA_HEADER, MEMBER_TEXT_LINES)
File "/QOpenSys/pkgs/lib/bob/src/makei/utils.py", line 409, in check_keyword_in_file
lines = file.readlines()
File "/QOpenSys/pkgs/lib/python3.9/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9b in position 912: invalid start byte

This weird error made me swear for hours. 

I finally realized (after inventing many new swear words) that the error that was causing the entire build process to explode was because I had special characters in my command source.

Special Characters -- in this case the source code contains the hex code for HIGH LIGHT BLUE in the title text. This has the nice effect of showing the command name in reverse image blue like this:

special char to highlight blue

So, lets remove those special characters:

UnicodeDecodeError: 'utf-8' codec can't decode byte 1

so it looks like this:

UnicodeDecodeError: 'utf-8' codec can't decode byte 2

and boom problem resolved:

UnicodeDecodeError: 'utf-8' codec can't decode byte 3

I found the same problem trying to compile a PRTF:

UnicodeDecodeError: 'utf-8' codec can't decode byte 4

In this case I replaced the special characters with an asterisk '*' which solved this compile problem.

I have no idea why this upsets the MAKEI process! Something do with codepages perhaps? Any ideas appreciated...

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>