Added encoding to getBytes and replaced /n with /r