Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-694

Provide some way for the C# driver to be more lenient about UTF8 validity

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.8
    • Affects Version/s: 1.7.1
    • Component/s: None
    • Labels:
      None

      The C# driver sets .NET's throwOnInvalidBytes argument to true when constructing a UTF8Encoding object. This results in exceptions being thrown when attempting to decode invalid UTF8 returned from the server.

      This is generally a good thing, so this should remain the default, but there are cases where other drivers (or mongoimport) create and store UTF8 that is not 100% UTF8 compliant and it would be useful to have a setting that tells the C# driver to be more tolerant of invalid UTF8 returned from the server.

      Note that round tripping a document that contains invalid UTF8 would then result in the document changing slightly, since the invalid UTF8 characters would be replaced by the Unicode character sequence for an invalid code point (\uFFFD\uFFFD). The new document would only differ where invalid code points were present, and the new document would now be 100% UTF8 compliant.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: