Works correct. Tested on some random English, Russian, Arabic and English-Arabic strings and multistrings. Everything works like it should. '\n' (if present) stay always at the end of the string.