Page 1 of 1

Breaking space

PostPosted: 22. February 2010 08:49
by Lcf.vs
Hya,

How can I put a breaking space in a filename with php? (breaking space is Alt+255 on Windows with belgian keyboard)

Please, reply in simple words as possible, I speak french, normally, and my english is really poor...

This script doesn't works:

Code: Select all
<?php
        $handle=fopen('file name with breaking space','w+');
        fclose($handle);
?>


Thank you by advance.

Re: Breaking space

PostPosted: 22. February 2010 09:29
by Nobbie
Whats the difference between space and breaking space?

Re: Breaking space

PostPosted: 22. February 2010 09:38
by Lcf.vs
With breaking space (if it's really his name in english), Apache is unable to serve it to the client.

I found this good tip for the security on Wamp, principally for includes.

Example, on Wamp, the client can call a file with a normal space in the filename but not with a breaking space. (it return a Forbidden access)

But the breaking space is usefull for a lot of things, example in php, You can't name a variable as $one variable but it works if You replace the space by a breaking space. ;)

Re: Breaking space

PostPosted: 22. February 2010 10:57
by syntax_error
Seems like a security through obscurity to me and using it in variable names is definitely not a good practice. Also, I don't think you really mean a breaking/zero-width space.

I think your problem is caused by different character encodings - on filesystem and in script. The character has probably different code in Windows encoding and in UTF-8 (default on most Linux systems). Or you're running even older Linux version, with some ISO 8859 character set... It's quite a mess...

So my recommendation is to get rid of this. If you don't believe me about the practice, you still have at least one reason: bad portability.