[Mono-list] problem with unicode strings

Jonathan Pryor jonpryor at vt.edu
Sat May 13 07:26:47 EDT 2006


On Fri, 2006-05-12 at 15:48 +0700, Yury Kuznesov wrote:
> when i try to output unicode string (e.g. with russian letters) via
> System.Console.WriteLine, i get string with '?'. E.g.:

What operating system are you on?

The problem is that Mono converts all strings to UTF-8 when writing to
the console.  (In general, Mono always uses UTF-8 when interacting with
strings outside of Mono, such as filenames, strings within shared
libraries, etc.)

If you're on Windows, UTF-8 won't mix well with CMD.EXE unless you set
the console's codepage to 65001 (iirc).

On Unix, you need to ensure that (1) your terminal program supports
UTF-8, and (2) $LANG is set to UTF-8 encoding, e.g.

	set LANG=en_US.UTF-8

 - Jon




More information about the Mono-list mailing list