[Mono-list] i18n Console.WriteLine problem

Atsushi Eno atsushi at ximian.com
Thu Apr 5 03:04:24 EDT 2007


As long as the code page in your console (including cygwin) does not
support U+20AC you will never see it (on Windows).

Just to make sure, the globalization and encoding parts work
fine. The snippet line below proves it:

	foreach (char c in localmoney)
		Console.Write ("{0:X04} ", (int) c);

Atsushi Eno

Paul wrote:
> Hi,
> 
> I've searched quite a bit on this and can find quite a few examples of
> using i18n in C#. The problem is that none of them deal with the
> conversion of strings which means that the UTF-8 console (which needs to
> be ISO-8859-15/EURO) is just missing out characters.
> 
> The code I've seen so far goes along these lines
> 
> using System;
> using System.Globalization;
> 
> public class foo
> {
>   static void Main()
>   {
>      CultureInfo current = CultureInfo.CurrentCulture;
>      CultureInfo germany = new CultureInfo ("de-DE");
>      double money = 123.45;
>      string localmoney = money.ToString("C", current);
>      Console.WriteLine(localmoney + " Local money");
>      localmoney = money.ToString("C", germany);
>      Console.WriteLine(localmoney + " German money");
>   }
> }
> 
> Fine for converting a currency, but how do I convert text so that what
> appears on the Console is correct?
> 
> The ultimate aim is to have this in a WinForm, but as I'm playing
> currently, it makes more sense to do things on the Console for now.
> 
> On a side note, is there any problem in having an ArrayList inside of a
> struct? When translating some words, there can be more than one correct
> answer and an ArrayList looks to be the best way to store them.
> 
> I can't use Mono.Unix and gettext_ as this isn't supported under Win32.
> 
> TTFN
> 
> Paul
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list



More information about the Mono-list mailing list