At least in your second example, you are not properly decoding your input.
I don't see what should be wrong? I did the same like in my first example, just turned the utf8 into iso-8859-1 on decode and file-open.
Your idea using the loop would be my second step. Just now I'm worried because ANSI to UTF8 doesn't work properly.