Fix serialization of unicode characters by using StreamWriter instead of Stream.Write