Re: Natilus using UTF-8 for filenames regardless of locale



On Sun, 2004-07-18 at 01:59, DANIELLLANO wrote:
> gabor wrote:
> > the guessing is usually something like this:
> > the application assumes that the filename is utf8. he begins to read it.
> > but then he founds out that it's not valid utf8. then he uses something else (
> > usually iso-8859-1 or locale-defined one).
> 
> Could someone point me where the code that does that is?
> I'm looking into implementing the same code in another gnome
> application.

i do not know how glib handles this, but imho it's simply:

byte[] b = readBytes();
string t = decodeBytes(b,"UTF-8");
if (t == null) //or any other way that signalizes that the decoding
failed
then t = decodeBytes(b,"ISO-8859-1"); //this will not fail because all
byte streams are valid iso-8859-1 strings.

gabor




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