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

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 1.7.1
    • 1.8
    • None
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: