I'm using this $str in my code, and it should display as 21156_MLA ß Copy4.ens.

I'm uploading a file with the filename 21156_MLA ß Copy4.ens, but on the browser display it's displaying as 21156_MLA Ã Copy4.ens. In the database it's stored properly as ß, but when we are retrieving that from the DB (using fetchall_hashref) it's getting converted to Ã. Subsequently the display on the browser is 21156_MLA Ã Copy4.ens. How to avoid this conversion here?

First, as PP notes, if your source file is encoded in UTF-8, you should use utf8; so that Perl will know that and interpret any string literals in it correctly.

Second, make sure the text in the database is also correctly encoded. The details of this will depend on you database, but e.g. for MySQL, the best way is probably to make sure your text columns have the utf8 character set and the utf8_unicode_ci collation (or the appropriate national collation scheme, if needed), and to include the mysql_enable_utf8 option when connecting to the database using DBI.

Third, you need to tell Perl that you want your I/O streams to be UTF-8 encoded, too. You can do this using binmode(), as in:

binmode STDOUT, ':utf8';

Finally, you also need to tell the browser that you're sending it UTF-8 text. (I suspect this part is your actual problem, but if you do all the other steps too, you'll have achieved a fully Unicode-aware workflow.) You can do this by sending the HTTP header: