Fixes to write replacement
Implement read replacement to handle OEM codepages