Open piaste opened 4 years ago
Given that you're proposing to change the string output as opposed to the binary output, I should say that it doesn't feel as much of a breaking change. I'd merge a PR that changes this, provided that we have verified that utf-16 xml can still be consumed by the deserializer, perhaps by adding a test that checks this.
Due to a well-known behaviour of the XML writer classes,
FsPickler
currently emits UTF-16 declared XML when callingPickleToString
, but UTF-8 declared XML when going thoughPickle
:I'm not sure if this is a considered a bug given the focused scope of the library, but it's certainly surprising.
(In my particular case, I had a pickled string rejected by SQL Server due to the different encoding.)
Fixing this so it emits UTF-8 XML through both methods should be straightforward - just generate a custom StringWriter or even an object expression in the pickleString function, but it would also technically be a breaking change. And it might be better to allow a configuration option.
Not particularly urgent since, as the above example shows, the workaround is a one-liner.