Add fopen compatibility layer

This commit adds fopen abstraction that can be overridden on other
platforms. This will allow conversion from UTF-8 to Unicode file paths on
platforms that require it.