Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1959

Specify exact reason in "invalid utf-8" exceptions

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • bson-4.6.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Minor Change

      Currently bson-ruby uses an implementation of utf-8 validator copied from libbson (the C driver). This implementation returns a boolean to indicate success/failure, and does not expose the reason for failure to calling code.

      This is particularly confusing when the validator claims that a string with an embedded null byte is "not valid utf-8". It actually is, the null byte check is separate from utf-8 validity check.

      Instead of the boolean return, the validator should expose exact reason for failure including the string containing null bytes.

      As part of this work, the current implementation of the validator in libbson is copied into bson-ruby.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: