-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2415 from anatawa12/validate-bson-string
chore: throw exception when encounter unpaired surrogate instead of replace with U+FFFD
- Loading branch information
Showing
5 changed files
with
26 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Text; | ||
|
||
namespace LiteDB | ||
{ | ||
internal class StringEncoding | ||
{ | ||
// Original Encoding.UTF8 will replace unpaired surrogate with U+FFFD, which is not suitable for database | ||
// so, we need to use new UTF8Encoding(false, true) to make throw exception when unpaired surrogate is found | ||
//public static System.Text.Encoding UTF8 = new UTF8Encoding(false, true); | ||
public static Encoding UTF8 = new UTF8Encoding(false, true); | ||
} | ||
} |