rejetto forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - habazlam

Pages: 1
1
HFS ~ HTTP File Server / Re: %filename-encoded% suggestion
« on: January 16, 2007, 12:19:14 PM »
Hi rejetto,

It was just my attmpt of of classification your "symbols" :)

For example, %filename% may be called "server defined symbol", but apparently %unauthorized% is totally "user-defined".

2
HFS ~ HTTP File Server / Re: %filename-encoded% suggestion
« on: January 14, 2007, 01:17:29 PM »
I meant that in the HFS/tpl context "symbol" is a kind of macro definition, right? From the other hand, there is the list of "symbols", which are generated by HFS, and a .tpl developer can't change them. So, these two parts of HFS symbols may be called as "server-defined" and "user-defined" - just for convenience :)

3
HFS ~ HTTP File Server / Re: %filename-encoded% suggestion
« on: January 14, 2007, 12:35:00 PM »
Just don't touch user-defined symbols :)

4
HFS ~ HTTP File Server / Re: %filename-encoded% suggestion
« on: January 14, 2007, 10:15:01 AM »
Quote
isolate? what you mean? to have two different encodings? if so, what's the gain?
In other words, just make such replacements only in %filename-js% and other native symbols, generated by HFS you may want to introduce, not in user-defined ones.

Example:

Code: [Select]
[progress-upload-file]
document.getElementById('PBFile').innerHTML  = '%filename%'+'Some string with some substrings \"quoted\" in \'different\' manners';
....and so on

Please note that theoretically both apostroph and double quote signs may appear in [progress-upload-file] in several syntax contexts (also the apostroph sign may be contained in %filename%) in this case. If you'll begin to sort these things out on the server side, a huge source of bugs may be created - just leave user-defined symbols for the .tpl developer's responsibility.

5
HFS ~ HTTP File Server / Re: %filename-encoded% suggestion
« on: January 14, 2007, 09:06:19 AM »
Hi rejetto,

Quote
i would introduce a symbol %filename-js% with ' and " encoded. is it enough?

Sure. Formally speaking, only string delimiters must be encoded inside %filename-js%:

Code: [Select]
<script type="text/javascript">
document.write('Test \x27<br>');
document.write('Test \x22<br>');
</script>

But I have to point you to the fact that theoretically the symbols in .tpl may be defined by .tpl developer as JavaScript fragments too, and in this case he/she may want to use JavaScript "escape sequences". So, you should isolate the first two ones from such replacement in other HFS functions (if you're going to use this replacement function in other pieces of HFS code, of course ;) ):

Code: [Select]
>>>> \'       Single quotation mark
>>>> \"       Double quotation mark
     \\       Backslash
     \b       Backspace
     \f       Form feed
     \n       New line
     \r       Carriage return
     \t       Horizontal tab
     \ddd     Octal sequence (3 digits: ddd)
     \xdd     Hexadecimal sequence (2 digits: dd)
     \udddd   Unicode sequence (4 hex digits: dddd)




6
HFS ~ HTTP File Server / %filename-encoded% suggestion
« on: January 13, 2007, 07:17:53 AM »
Hi rejetto,

Assume that I'm doing something like this in .tpl:

....onClick="SomeFunction('%filename%')"...., where SomeFunction() prosesses STRING %filename% in some manner.

Now imagine that %filename% is equal to O'Reilly - Writing HFS Modules with Perl and C.chm :)

Obviously, I get a syntax error if I the "'" (apostroph) symbol is not encoded (certainly, there are other symbols that must be encoded for this case).

Of course, there are a lot of tricks to make a workaround for this kind of errors, but as a result, the JavaScript code in .tpl becomes unnecessarily complex.

This is the reason of my suggestion of the %filename-encoded% symbol.

BTW, thanks a lot for the HFS project: I was so impressed that began to develop a single-page HTML/DOM version of .tpl in my spare time :)

Pages: 1