[M3devel] Pathname.Legal

Stefan Sperling stsp at elego.de
Sun Oct 14 12:05:27 CEST 2007


On Sun, Oct 14, 2007 at 12:24:48AM +0200, Neels Janosch Hofmeyr wrote:
> Hello all,
> 
> I encountered the problem that, in my cm3 compile,
> FS.GetAbsolutePathname cannot handle special characters in file names.
> As soon as a file contains a special character (ä, ß, ø, ...), a
> Pathname.Invalid exception is raised.
> 
> This happens because PathnamePosix.m3 has a list of legal characters:
> 
>   CONST Legal = SET OF CHAR {'\001' .. '\177'} - SET OF CHAR {DirSepChar};
> 
> which is enforced in Pathname.Compose and Pathname.ParsePosixPathname.
> 
> Pathname.Legal contains the complete ASCII list -- but no more than
> that. This means that characters like ä are considered illegal characters.

How does CM3 handle locales?

Is there a way to access locales (and similar facitilies
on non-UNIXish systems) from Modula3 to determine characters
the system consideres legal in filenames? At least those
encoded in ISO8859* ?

> I reversed the Legal list to an Illegal list like this:
> 
>   CONST Illegal = SET OF CHAR {DirSepChar};
> 
> and also reversed the IF logic, replacing Legal with Illegal. This way
> all characters are allowed, except the DirSepChar. And voila, it works.
> PathnamePosix.m3 accepts weird filenames.

What happens now if you try to use a filename that is
UTF-8 encoded and contains a character that spans more than one byte?

Maybe the restriction to ASCII was made on purpose to protect
users from CM3's non-existent unicode support?

-- 
Stefan Sperling <stsp at elego.de>                 Software Developer
elego Software Solutions GmbH                            HRB 77719
Gustav-Meyer-Allee 25, Gebaeude 12        Tel:  +49 30 23 45 86 96 
13355 Berlin                              Fax:  +49 30 23 45 86 95
http://www.elego.de                 Geschaeftsfuehrer: Olaf Wagner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20071014/11bb7fbc/attachment-0002.sig>


More information about the M3devel mailing list