[JAVA-4431] Driver allows inserting invalid UTF-8 strings Created: 21/Dec/21 Updated: 10/Oct/22 Resolved: 10/Oct/22 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | BSON |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Stephen Machnowski | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | external-user | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Case: | (copied to CRM) | ||||||||||||
| Description |
| Comments |
| Comment by Jeffrey Yemin [ 10/Oct/22 ] | ||||||||||
|
Since it's not considered a server error to insert invalid UTF-8, it's not clear that drivers should consider it an error.Β And it could also be viewed as a backwards-breaking change, as there could be legitimate reasons why an application would be doing this. Closing as Won't Fix. | ||||||||||
| Comment by Esha Bhargava [ 04/Jan/22 ] | ||||||||||
|
This is something we can fix, but there is a cost that we have to make sure it's acceptable. For now we've decided to put it in the backlog. | ||||||||||
| Comment by Jeffrey Yemin [ 04/Jan/22 ] | ||||||||||
|
Maybe:
| ||||||||||
| Comment by Jeffrey Yemin [ 04/Jan/22 ] | ||||||||||
|
The fix would be in this method. Perhaps something like:
but that's not right, since it evaluates to true for a proper surrogate pair as well. By the way: the reason that method doesn't just call String#getBytes is to avoid an unnecessary array allocation and copy. | ||||||||||
| Comment by Esha Bhargava [ 21/Dec/21 ] | ||||||||||
|
smachnowski@ixl.com Thank you for filing the issue! We'll look into it and get back to you soon. |