backslash

Jorge Almeida jjalmeida at gmail.com
Thu Jun 26 01:46:44 PDT 2008


On Thu, 26 Jun 2008, Roger Oberholtzer wrote:

>>> Perhaps you could choose some obscure utf-8 character. Even though Linux
>>> file systems are often utf-8, you could choose some obscure Burmese
>>> character that seldom shows up in a file name...
>>>
>> I know nothing about this kind of stuff. It would have to be something
>> that I can manage through a lean C program, not requiring some strange
>> library...
>
> utf-8 is only a 16-bit (a.k.a. wide) character set. All this is
> available in C. For example, the utf-8 compatible printf is called
> wprintf.  All these are controlled by the LC_CTYPE environment variable.
> You could set this in your code (via setenv in C) to some obscure
> locale, like the suggested Burmese, and then use a character from that
> in your work. It is actually very little different in your code (depends
> on your code) to do this. Granted this has 'hack' written all over it...
>
It seems problematic... I'm linking it against dietlibc, to produce a
lean static binary, and I don't think it plays well with locales stuff.
And I want to change the input string ("/usr/bin/less") in place,
without allocating more memory and copying it somewhere else, so using
2 bytes to replace 1 would break it (and using 2 bytes everywhere would
be a large overhead---the directory is about 9M...)

Maybe I have to think more about this. Perhaps accepting some ambiguity
is not that bad...

Jorge



More information about the Linux-users mailing list