sinbao has asked for the wisdom of the Perl Monks concerning the following question:

I failed to do that by code
open MyFile, ">:encoding(utf-8 )", "a.txt";
print MyFile "aaaa";
close MyFile

Question is, I want to write a visual studio solution file (.sln) which can't be recognized if it is not encoded in UTF-8 although the characters in it are all ASCII