Help with Converting UTF-8 data to Unicode

How can I get an error when converting 3rd line, since it has invalid characters

abcde
a®cdée
acd�

Unicode for
® = �
é = �

I used "iconv -f UTF-8 -t ISO-8859-15 in.txt > out.txt"

Just pasting the invalid characters into your web browser doesn't tell us what they are, as they will have passed through many levels of translation which have garbled them beyond recognition.

Conversion can't fix them if they're actually invalid in the first place, either. It'll find the "right" equivalent, if possible, for it to remain "broken" the same way in the different character set.

Can you show us part of a hex dump of the text file so we can see what the offending characters are? hexdump -C file

Please post a Hexadecimal and Ascii dump of both in.txt and out.txt. As you have omitted to mention what Operating System and version you have, I can only suggest the unix "od" command (complete with suitable parameters for your system).