Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-5839

Truncate multi-byte codepoints in compliance with spec

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 6.4.0
    • Affects Version/s: None
    • Component/s: Logging
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Currently, our logger's stringifyWithMaxLen function counts each unicode-byte as a unit of length. This can cause multibyte unicode code-points, such as characters in other languages or certain emojis, do get truncated in non-sensical ways.  We should round down to the nearest code-point when we encounter this.

      Likely will follow implementation in Anna's comment

      Use Case

      As a... non-english speaking user 
      I want... logging to support my alphabet
      So that... I receive well-formed strings from  logger output

      User Impact

      • Clients with non-english speaking users
      • Clients with users who use emojis (would only really be for custom logs)

      Dependencies

      • None, logging is unreleased

      Acceptance Criteria

      Implementation Requirements

      • When a string contains multi-byte codepoint(s) and is truncated mid code-point round down to the nearest whole codepoint to avoid non "well-formed" strings being outputted to users

      Testing Requirements

      • Unskip command logging prose test #3 (contains necessary unit testing)

       

            Assignee:
            aditi.khare@mongodb.com Aditi Khare
            Reporter:
            aditi.khare@mongodb.com Aditi Khare
            Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: