I think run-time would be more likely (do it as one of your first start up tasks). However, I don't think that would be possible.
You could have a static member variable of one of your main classes set to the encoder you desire. You'll still need to do a run-through of your code to update all the encoder references though. This would also give you the ability to easily (run or compile time) to change the encoder. -Jim Stapleton -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Ian Norton Sent: Thursday, July 21, 2011 3:24 PM To: Pablo Ruiz; Tim Nelson Cc: [email protected] Subject: Re: [Mono-list] Encoding Issue .Net vs. Mono Can I change the default encoding at compile time? Or perhaps some app configs? "Use a different encoder" doesn't help people without sources Pablo Ruiz <[email protected]> wrote: >Use Encoding.UTF16 instead of Encoding.Default. > > >On Thu, Jul 21, 2011 at 9:17 PM, Tim Nelson < >[email protected]<mailto:[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]<mailto:[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]<mailto:[email protected]> >http://lists.ximian.com/mailman/listinfo/mono-list > > > _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list -- BEGIN-ANTISPAM-VOTING-LINKS ------------------------------------------------------ Teach CanIt if this mail (ID 1228829899) is spam: Spam: https://antispam.osu.edu/b.php?i=1228829899&m=8da011760b45&c=s Not spam: https://antispam.osu.edu/b.php?i=1228829899&m=8da011760b45&c=n Forget vote: https://antispam.osu.edu/b.php?i=1228829899&m=8da011760b45&c=f ------------------------------------------------------ END-ANTISPAM-VOTING-LINKS _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
