Re: [AD] Allegro unable to deal with non ascii filenames |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: Re: [AD] Allegro unable to deal with non ascii filenames
- From: Chris <chris.kcat@xxxxxxxxxx>
- Date: Sat, 27 May 2006 16:00:42 -0700
On Saturday 27 May 2006 14:48, Elias Pschernig wrote:
> On Sat, 2006-05-27 at 22:40 +0200, Michal Molhanec wrote:
> > Hello,
> > don't tell me that there is no way on Linux how to ask system which
> > system encoding is used and/or to convert string from/to UTF-8 to the
> > system encoding.
>
> Well, probably all libc functions will use the current locale setting.
> So if your locale is UTF8, filenames will be returned as UTF8. If it is
> latin1, filenames will be latin1.
Wouldn't it be possible to read this info from the LANG environment variable?
For me, this is LANG="en_US.UTF-8" and passing UTF-8 data to the file
functions seems to work just fine (filetest shows all the info properly, and
ufile.c was changed to pass UTF-8 data instead of ASCII.
I'm not really sure how to handle this, though. Just creating a new function
won't relly help because it would need to be called with a specific value
between systems. Perhaps it could just use a new internal setting that's set
when allegro_init is called, using the LANG variable. Then when accessing
files, it'd convert to that setting. IIRC, the Mac port uses something like
_al_open for some internal magic, so perhaps this could be extended to
Windows to convert filenames to UTF-16 and use _wopen on NT/2k/XP, and on
Unix/Win9x convert to the current system locale setting and call the plain
open function.
Sounds a bit too much to do for 4.2.1 though, IMO.