LC_COLLATE is setting character range

I'm new to this platform and not sure whether what I'm reporting is a bug or not. But this is the issue I'm encountering.

I had a special character(Â) which gave error while using sed.

echo $'H\xc3\x82Bnc' | sed -E 's/[A-Z]*/`&`/g'
sed: RE error: illegal byte sequence

$ locale
LANG=""
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

Now if I set LC_COLLATE, then the command works.

echo $'H\xc3\x82Bnc' | LC_COLLATE="en_US.UTF-8" sed -E 's/[A-Z]*/`&`/g'
`HÂB`n``c``

Is LC_COLLATE affecting the character range. Why after LC_COLLATE was set, did the code produce no error of illegal byte sequence? I'm using Mac OS 13.1

Replies

I found out that LC_COLLATE is used to compare characters, so while comparing  with the range [A-Z] it was giving error. The documentation should be more clearer