Specify which encoder you want to use (System.Text.Encoding.Unicode or
System.Text.Encoding.UTF8) for for dumping strings and you will get the same
behavior for .NET and Mono.

It just happens that Mono use a different encoder for it's default.

Diego Frata
[email protected]


On Thu, Jul 21, 2011 at 4:17 PM, Tim Nelson <[email protected]>wrote:

> Just to be sure I understand...
>
> Since I inherited a pile of code that was relying on byte/string
> conversions...
>
> I am dead in the water and there is no trick I can play to coerce Mono
> strings to be UTF16, correct?
>
> On Thu, Jul 21, 2011 at 2:47 PM, 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]>
> > 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]
> >> 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