Re: character sets and filenames

Sam Varshavchik <[email protected]> Tue, 09 Mar 2004 21:10:37 -0500
Newsgroups gmane.comp.audio.zinf.devel
Message-ID <[email protected]>
Kristian G. Kvilekval writes:

> On Tue, 2004-03-09 at 17:49, Sam Varshavchik wrote:
> 
>> The user used an encoding other than the "encoding used by the operating 
>> system."
>> 
>> By fiat, Unix filenames have been decreed to be using UTF-8; still plenty of 
>> stuff creates files using iso-8859-1, et al…
>> 
>> There is no easy solution for this one.
> 
> How about a tool to guess the encoding and re-write the filenames
> as UTF8.  Would this sufficient?

It's the lesser of all evils.  I think the following heuristics are probably 
the best one can do:

A)  Try to see if the filename parses in UTF-8.  Stuff that's not UTF-8 is 
very unlikely to be parsable as valid UTF-8.

B)  Try nl_langinfo(CODESET).  Not all platforms have that call.  You'll 
need to probe if this is implemented, in configure.ac.

C)  ????
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQBATnkdx9p3GYHlUOIRAuBcAJ9sAt3d058wJLeHosS3bI2od34yQQCfR09v
X8wA5V+Rprzf1cZN04xy32o=
=+Acp
-----END PGP SIGNATURE-----