Convert data to unicode before replacing newlines