Re: [Nautilus-list] A fix for non-ASCII characters (and hello)



On 1/18/02 12:25 PM, "Håvard Wigtil" <havardw stud ntnu no> wrote:

> I've been looking at how I can contribute to Nautilus.

Great! Welcome.

> I built Gnome 2
> from CVS, and discovered that Nautilus can't even spell my name!
> ('Håvard' becomes 'H?vard').  Investigation shows that the file name
> conversion code (make_valid_utf8 in libnautilus-private/nautilus-file.c)
> doesn't try to convert non-ASCII characters, it just replaces them with
> question marks.

That's incorrect.

What's happening here is that the file name is encoded in ISO-8859-1, and
glib 2.x treats all file names as if they are UTF-8. It's not all non-ASCII
characters that are replaced with question marks; illegal UTF-8 sequences
are replaced with question marks, but you can use all sorts of non-ASCII
characters.

If you have a file that has the name 'Håvard' encoded in UTF-8, then it will
show up fine in Nautilus. But the other tools on your system, like ls and
the terminal, are using ISO-8859-1, which makes things rather confusing.

We need to talk to the glib maintainers and other experts about how to deal
with this.

> I've filed a bug in bugzilla, and attatched my first attempt at a patch:
> http://bugzilla.gnome.org/show_bug.cgi?id=69059

I've added comments to that bug report.

> This does not solve the special case where the UTF-8 escape marker ('Â',
> capital A with a rooftop over),

That's not "the UTF-8 escape marker". It's true that adding that character
is a simple-minded way to convert an ISO-8859-1 character to a UTF-8
sequence, but there are lots of other ways UTF-8 encodes various characters.

> because a string containging this char
> may pass as valid UTF-8. (Try to create a file called 'Test©', it will
> show as 'Test©' with my patch.) The only solution to this that I can see
> is to always convert file names to UTF-8.

The problem is that file names can't be "either UTF-8 or ISO-8859-1". You
have to use one or the other.

> As I said I've been looking at how I can contribute. I've been
> programming since I first got my hands on a computer (about 14 years
> ago), but mostly in Java the last years. I want to return to system
> programming, but my C is more than a little bit rusty, so please forgive
> me if it looks clumsy. (And using Java, I've forgotten all about memory
> management ;)

The best way to contribute is to do what you're doing; find a bug and
contribute a bug fix. Sadly, this first bug is not an easy one because it
hinges on a tricky design issue.

> I realize there is much work to do on Nautilus, but there is also a
> large codebase to understand, so I hope someone knowledgeable can point
> me to things that needs doing. (Just grepping for
> GNOME2_CONVERSION_COMPLETE is currently a too vague job description for
> me.)

Find a bug in Nautilus and fix it -- that's the best way to start.

If you don't want to grep for GNOME2_CONVERSION_COMPLETE, you can use the
program, find a bug, and try to fix the bug you found.

    -- Darin





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