What are "surrogates", how do I allow them and why is there nothing on this?

Question:
Im coding something with unicode characters but when it works it looks like
\udd01𣳸 \udc1f𠸈 \udd00𧼀 \udde2𚫰 \udec3𡻨
but if it doesnt it tells me that “surrogates not allowed”

Repl link:
link

Traceback (most recent call last):
  File "/home/runner/TCC-Project-Pt1-Comp/change2beta.py", line 24, in process_decimal_file
    output_file.write(char)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udd01' in position 0: surrogates not allowed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/runner/TCC-Project-Pt1-Comp/change2beta.py", line 41, in <module>
    process_decimal_file("decimal_pixel_data.txt", "unicode_pixel_data.txt")
  File "/home/runner/TCC-Project-Pt1-Comp/change2beta.py", line 29, in process_decimal_file
    raise Exception("Error during processing") from e
Exception: Error during processing

Edit: If this is some kind of replit only problem, where can i go so i dont have this problem?

Edit2: With debugging, i finally got it, and now learned that they are “privately used, reserved, or replacement characters” and now are displaying

�𣳸�𠸈�𧼀�𚫰�𡻨𞹠𥽘𭍐𔦨뺠𗒠𛦨𮜸𡏈

now i need help with seeing if i can recognize that a character is privately used, reserved, or replacement characters, then just in general replacing it with a placeholder character (which I’ve decided to be “#”)
Then i just need something that has a list with supposedly 12k characters