When I tested this little script:
$str = \"apple\";
echo md5($str);
The result matched the result of doing md5 using utf8 (tested using C#
Simply md5() will always give the same encoding. If you cannot trust it, Simply you can encode data in Database itself.
The encoding of a string literal is whatever encoding you saved the source file in. If you saved this php file in UTF-16, you would get a different result, that is, if the code even runs.
There is no unified or managed encoding in PHP. Strings in PHP can be in any encoding, in other words, they are equivalent to byte arrays of languages that have more abstract string type.