The default encoder for .NET is coherent with the fact that the internal
string representation is Unicode (UTF16). If a future version of .NET is to
change the internal string representation, it might change it's default
encoder as well.

Never rely on this property for interoping strings between different
applications and runtimes. Always choose the encoder you want to use.

Diego Frata
[email protected]


On Thu, Jul 21, 2011 at 4:22 PM, Diego Frata <[email protected]> wrote:

> Pablo, shouldn't it be Encoding.Unicode?
> Diego Frata
> [email protected]
>
>
> On Thu, Jul 21, 2011 at 4:21 PM, Ian Norton <[email protected]> wrote:
>
>> That sounds a little daft, why do we differ?
>>
>> Pablo Ruiz <[email protected]> wrote:
>>
>> >Mono uses UTF8 as default encoding. .Net uses UTF16
>> >
>> >
>> >On Thu, Jul 21, 2011 at 8:42 PM, Tim Nelson < [email protected]
>> <mailto:[email protected]>> wrote:
>> >
>> >
>> >New to Mono, but I am getting a strange result when Encoding bytes and
>> >returning a string:
>> >
>> >
>> >    int n =  System.Text.Encoding.Default.GetString(new byte[] { 0,
>> >194, 146, 215 }).Length;
>> >
>> >On .Net, this returns 4.
>> >On Mono, this returns 3.
>> >
>> >If I change the second byte 194 to 193 ... both systems return 4.
>> >
>> >Is this a Mono bug or my lack of experience with encoding?   If it is
>> >a bug, is there a way around this?
>> >_______________________________________________
>> >Mono-list maillist  -   [email protected]<mailto:
>> [email protected]>
>> >http://lists.ximian.com/mailman/listinfo/mono-list
>> >
>> >
>> >
>> _______________________________________________
>> Mono-list maillist  -  [email protected]
>> http://lists.ximian.com/mailman/listinfo/mono-list
>>
>
>
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to