[JAVA-1305] Ensure that an exception is thrown if a BSON string is not valid UTF-8 Created: 03/Jul/14  Updated: 20/Oct/20  Resolved: 20/Oct/20

Status: Closed
Project: Java Driver
Component/s: BSON
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to PYTHON-721 BSON Errors with invalid utf8 strings. Closed
related to CSHARP-694 Provide some way for the C# driver to... Closed

 Description   

Currently the driver calls java.lang.String#String(byte[], int, int, java.lang.String) to decode UTF-8 byte arrays, but this method silently replaces invalid UTF-8 byte sequences with a replacement character.

The driver should instead use CharsetDecoder directly so that an exception can be thrown instead.



 Comments   
Comment by Jeffrey Yemin [ 03/Jul/14 ]

So .NET driver went with a client setting to allow leniency.

Generated at Thu Feb 08 08:54:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.