<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:38:24 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-996] ERROR Unable to translate bytes at index N from specified code page to Unicode.</title>
                <link>https://jira.mongodb.org/browse/CSHARP-996</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;We have faced with following exception trying to read from DB, and we can not reproduce it once more. All read\write operations to Mongo DB are perfomed with C# MongoDB driver 1.8.3, Mongo DB version : 2.6.1.&lt;/p&gt;

&lt;p&gt;ERROR Unable to translate bytes &lt;span class=&quot;error&quot;&gt;&amp;#91;AB&amp;#93;&lt;/span&gt; at index 106 from specified code page to Unicode.&lt;br/&gt;
Exception: System.Text.DecoderFallbackException&lt;br/&gt;
Message: Unable to translate bytes &lt;span class=&quot;error&quot;&gt;&amp;#91;AB&amp;#93;&lt;/span&gt; at index 106 from specified code page to Unicode.&lt;br/&gt;
Source: mscorlib&lt;br/&gt;
at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index)&lt;br/&gt;
at System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index)&lt;br/&gt;
at System.Text.DecoderFallbackBuffer.InternalFallback(Byte[] bytes, Byte* pBytes)&lt;br/&gt;
at System.Text.UTF8Encoding.GetCharCount(Byte* bytes, Int32 count, DecoderNLS baseDecoder)&lt;br/&gt;
at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encoding)&lt;br/&gt;
at System.Text.UTF8Encoding.GetString(Byte[] bytes, Int32 index, Int32 count)&lt;br/&gt;
at MongoDB.Bson.IO.BsonBuffer.DecodeUtf8String(UTF8Encoding encoding, Byte[] buffer, Int32 index, Int32 count)&lt;br/&gt;
at MongoDB.Bson.IO.BsonBuffer.ReadString(UTF8Encoding encoding)&lt;br/&gt;
at MongoDB.Bson.IO.BsonBinaryReader.ReadString()&lt;br/&gt;
at MongoDB.Bson.Serialization.Serializers.BsonStringSerializer.Deserialize(BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options)&lt;br/&gt;
at MongoDB.Bson.Serialization.Serializers.BsonBaseSerializer.Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options)&lt;br/&gt;
at MongoDB.Bson.Serialization.Serializers.BsonValueSerializer.Deserialize(BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options)&lt;br/&gt;
at MongoDB.Bson.Serialization.Serializers.BsonBaseSerializer.Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options)&lt;br/&gt;
at MongoDB.Bson.Serialization.Serializers.BsonDocumentSerializer.Deserialize(BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options)&lt;br/&gt;
at MongoDB.Bson.Serialization.Serializers.BsonBaseSerializer.Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options)&lt;br/&gt;
at MongoDB.Driver.Internal.MongoReplyMessage`1.ReadFrom(BsonBuffer buffer, IBsonSerializationOptions serializationOptions)&lt;br/&gt;
at MongoDB.Driver.Internal.MongoConnection.ReceiveMessage&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(BsonBinaryReaderSettings readerSettings, IBsonSerializer serializer, IBsonSerializationOptions serializationOptions)&lt;br/&gt;
at MongoDB.Driver.Operations.QueryOperation`1.GetFirstBatch(IConnectionProvider connectionProvider)&lt;br/&gt;
at MongoDB.Driver.Operations.QueryOperation`1.&amp;lt;Execute&amp;gt;d__0.MoveNext()&lt;br/&gt;
at System.Linq.Enumerable.FirstOrDefault&lt;span class=&quot;error&quot;&gt;&amp;#91;TSource&amp;#93;&lt;/span&gt;(IEnumerable`1 source)&lt;br/&gt;
at MongoDB.Driver.MongoCollection.FindOneAs&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(IMongoQuery query)&lt;br/&gt;
at MongoDB.Driver.MongoCollection.FindOneByIdAs&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(BsonValue id)&lt;/p&gt;</description>
                <environment>Mongo DB version : 2.6.1&lt;br/&gt;
OS : Windows 8 </environment>
        <key id="142225">CSHARP-996</key>
            <summary>ERROR Unable to translate bytes at index N from specified code page to Unicode.</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="maximvsidorenko">Maxim Sidorenko</reporter>
                        <labels>
                    </labels>
                <created>Mon, 16 Jun 2014 10:51:55 +0000</created>
                <updated>Sat, 4 Apr 2015 22:49:41 +0000</updated>
                            <resolved>Sat, 4 Apr 2015 22:49:41 +0000</resolved>
                                    <version>1.8.3</version>
                                                    <component>API</component>
                    <component>BSON</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="622693" author="rstam" created="Mon, 16 Jun 2014 11:56:47 +0000"  >&lt;p&gt;String data is stored in MongoDB as UTF8 strings. This exception occurs when the driver is converting a UTF8 encoded string to Unicode (the in-memory representation used by a C# string).&lt;/p&gt;

&lt;p&gt;Somehow a document with invalid UTF8 has been introduced to the database. If all documents were inserted using the C# driver this should not be possible, since the C# driver uses the same UTF8 encoder to encode the stored UTF8 strings as to decode them.&lt;/p&gt;

&lt;p&gt;The last time I encountered this issue the problematic UTF8 data had been inserted into the database using mongoimport.&lt;/p&gt;

&lt;p&gt;If necessary you can configure the C# driver to be more lenient in its UTF8 decoding. You can do that by setting the ReadEncoding property in either MongoClientSettings, MongoDatabaseSettings or MongoCollectionSettings.&lt;/p&gt;

&lt;p&gt;By default the C# driver uses a strict encoder (which is why you are getting this exception when the UTF8 data is invalid). You can configure a lenient encoder like this:&lt;/p&gt;

&lt;p&gt;var throwOnInvalidBytes = false;&lt;br/&gt;
clientSettings.ReadEncoding = new UTF8Encoding(false, throwOnInvalidBytes); &lt;/p&gt;

&lt;p&gt;A lenient encoding will do the best it can to decode UTF8, even if it is invalid. Any invalid UTF8 bytes are decoded to a special Unicode character that represents an &quot;invalid character&quot;.&lt;/p&gt;

&lt;p&gt;Keep in mind that if you use a lenient encoding and you read a document containing invalid UTF8 and then save it back to the database the UTF8 encoding will change slightly (from the original invalid UTF8 data to a valid UTF8 representation of the &quot;invalid character&quot; Unicode code point).&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrfdlj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2076</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>