Re: [AD] dmc unicode patch

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 7/21/07, Peter Wang <novalazy@xxxxxxxxxx> wrote:
You're right.  I did a test and pack_fopen can't open UTF-8 filenames if
SYSTEM_NONE is used.  So this change was incomplete:

    r5863 (orig r5816):  elias | 2006-05-30 23:05:01 +1000

It also added set_filename_encoding and get_filename_encoding but they
were never documented.  So, are they supposed to be public or not?

There was a 6 month long discussion during the latter half of 2006
under the name of "Allegro unable to deal with non ascii filenames". I
haven't read through it, but the current way its handled seems like a
bad way of doing it. (There's no central point for setting the
encoding, etc.)

I'm guessing that set_file_encoding and get_file_encoding are supposed
to be public. I don't really like the names of the functions though
because it's the file _name_ (or path) encoding that's being set. As
is, it sounds like its the encoding of the file itself. So maybe its
best that they haven't been documented yet.

I would think the best way of handling this would be to make those
functions public, rename them to something that's better, and create a
default case:

void set_filename_encoding(int encoding)
{
 if (encoding == AUTODETECT_FILENAME_ENCODING   /* for lack of a
better constant name... */)
 {
   // auto detect
 }
 else
   filename_encoding = encoding;
}

install_allegro could then call
set_filename_encoding(AUTODETECT_FILENAME_ENCODING) and we wouldn't
have to worry about any system driver forgetting to set it.


--
Matthew Leverton




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/