I still can't solve this problem. I presume it's related to the charcater encoding. All problem domain names are in ASCII format. Even though the original HTML source format is UTF-8.
I presume the output from preg_match_all is in ASCII - now need to check either how to convert it back, or how to make preg_match_all output UTF-8.
After it is ASCII the data is extremely resistant to changes and I didn't manage you to get it back to UTF-8. I don't understand why utf8_encode() or mb_convert_encoding() fail to work.