diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ExecutionComponent/Distinct/DistinctMap.UnorderedDistinctMap.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ExecutionComponent/Distinct/DistinctMap.UnorderedDistinctMap.cs index ed3dcb57fa..07ba695367 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ExecutionComponent/Distinct/DistinctMap.UnorderedDistinctMap.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ExecutionComponent/Distinct/DistinctMap.UnorderedDistinctMap.cs @@ -343,7 +343,7 @@ private bool AddStringValue(string value) { // Zero out the array since you want all trailing bytes to be 0 for the conversions that happen next. Array.Clear(this.utf8Buffer, 0, this.utf8Buffer.Length); - Encoding.UTF8.GetBytes(value, 0, utf8Length, this.utf8Buffer, 0); + Encoding.UTF8.GetBytes(value, 0, value.Length, this.utf8Buffer, 0); if (utf8Length == 0) { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CrossPartitionQueryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CrossPartitionQueryTests.cs index 7ea31d8e1a..25dd008886 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CrossPartitionQueryTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CrossPartitionQueryTests.cs @@ -4816,6 +4816,8 @@ private static string GetRandomName(Random rand) stringBuilder.Append('a' + rand.Next(0, 26)); } + stringBuilder.Append("💩"); + return stringBuilder.ToString(); } diff --git a/changelog.md b/changelog.md index 51d3750de8..1b83c1a012 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - [#1070](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1070) CreateItem will only retry for auto-extracted partition key in-case of collection re-creation +- [#1060](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1060) Fixed unicode encoding bug in DISTINCT queries. ## [3.5.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.5.0) - 2019-12-03