Re: [Vala] Coding standard: indentation?



On Wed, Feb 11, 2009 at 8:55 AM, Thomas Chust <chust web de> wrote:
2009-02-10 Frederik <scumm_fredo gmx net>:
Michel Salim wrote:
[...]
The string 'cr?me br?l?e' is 12 characters long and is stored in 15 bytes

The accents disappear on printing?
[...]

You're right. With print () it doesn't work, but with stdout.printf ()
it works. That's strange.
[...]

Hello,

it's not that strange, actually: print is GLib's g_print, which
expects a UTF-8 encoded string and tries to convert it into the
correct output encoding for the current locale. stdout.printf on the
other hand is the C library's fprintf, which simply writes the bytes
it gets to the target stream.

Therefore, if your locale setting doesn't match your terminal's output
encoding or if your program didn't call setlocale correctly, print is
very unlikely to work.

Same on Fedora 10, and everything ought to already be UTF-8:

$ set | grep LANG
GDM_LANG=en_US.UTF-8
LANG=en_US.UTF-8
$ ./stringsample | grep "The string"
The string 'cr?me br?l?e' is 12 characters long and is stored in 15 bytes
$ file stringsample.vala
stringsample.vala: UTF-8 Unicode C++ program text

I've tried opening the file in gedit and saving it as UTF8 to be sure;
this is on gnome-terminal. Any idea?

-- 
miʃel salim  •  http://hircus.jaiku.com/
IUCS         •  msalim cs indiana edu
Fedora       •  salimma fedoraproject org
MacPorts     •  hircus macports org



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]