Re: [AD] unicode proposal

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


On January 21, 2009, Elias Pschernig wrote:
> On Tue, 2009-01-20 at 21:04 -0700, Thomas Fjellstrom wrote:
> > > I thought you get an ALLEGRO_FS_ENTRY for each file, so could use that.
> > > If that's not how it works, maybe we could make it like that - so you
> > > can get a "display name" for a file, but still retain the actual file
> > > handle (with the internal name).
> >
> > Its how I've been intending to make it, didn't think anyone would like it
> > though. But the handles returned from readdir won't be opened (but will
> > be openable).
>
> How does it work in Windows right now? Can I pass filenames returned by
> al_fs_readdir to al_textprintf? My programs working differently under
> Windows and Linux is the only thing I was really concerned about, not
> the 1% of Unix systems with obscure filename encodings.
>
> So if the answer is yes and the only time we would need a separate
> "display name" is on old Unixes, I think now we should do as Peter said
> - simply don't convert at all. al_textprintf already will replace
> invalid UTF8 characters with �, at least when using the TTF addon - so
> filenames look just like they do on the console with "ls".

Hmm, right now the string you get from readdir is a byte for byte copy of the 
string the OS returns. so it aught to work, but may not be displayable in any 
usefull form.

I intend to make sure the functions under windows always use the wide char 
funcs (16bit unicode), and down convert to utf8. That shouldn't break anything 
afaik. What might break is if the files are actually in some strange encoding 
like sjis or whatnot (which they shouldn't be in NT based OSs, but you never 
know). With linux, it may break files that aren't in the right encoding to 
begin with. We might be better off not converting at all if we want this to 
work... But honestly, why do you have mixed filenames? Especially in an allegro 
app, a very large percentage of applications using allegro will only use files 
it ships.

Do we "fix" the issue by catering to a (very) small minority of users? And then 
force everyone else to convert from the OS format (UCS2 or ascii, or some 
strange encoding that they might not be able to detect) to UTF8 (or ascii 
maybe) every time they interact with the filesystem?

Maybe we can provide a "displayname" corralary to the "al_fs_entry_name" 
function, the entry keeps two versions, one in UTF8 to hand out to the user to 
display, and one in whatever format it was given to give back to the os? That 
might make the ALLEGRO_PATH stuff interesting. It parses and builds its strings 
using U_CURRENT iirc.

> --
> Elias Pschernig <elias@xxxxxxxxxx>
>
>
> ---------------------------------------------------------------------------
>--- This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword


-- 
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx




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