Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > HTML Problem

Reply
Thread Tools

HTML Problem

 
 
CyberDroog
Guest
Posts: n/a
 
      07-14-2005
At least I think it is... I have been playing with HttpFileServer
v2.0beta23 (http://www.rejetto.com/sw/) along with some user created
templates.

One of the template has a problem with file names that contain a single
quote character. The forum for the software doesn't seem to have much
traffic, so maybe someone here can see what the problem is and how to fix
it.

An example line from the code to display a file name: <tr class="mout"
onmouseover="this.className='mover'" onmouseout="this.className='mout'"
onclick="location.href='%item-url%'">

The part: onclick="location.href='%item-url%' seems to be the problem since
it is surrounded by single quotes. When it comes across a folder name such
as: CD's, that seems to translate in the code to 'CD's', and the code
chokes. Clicking the link does nothing, and reloading the file list can
produce an "Error expecting ;" for every file or folder name that contains
a single quote.

Is there a simple way to fix this?

--
MONDAY, n. In Christian countries, the day after the baseball game.

- Ambrose Bierce

 
Reply With Quote
 
 
 
 
Martin Jay
Guest
Posts: n/a
 
      07-14-2005
In message <>, CyberDroog
<> writes
>At least I think it is... I have been playing with HttpFileServer
>v2.0beta23 (http://www.rejetto.com/sw/) along with some user created
>templates.


[Snip]

>The part: onclick="location.href='%item-url%' seems to be the problem since
>it is surrounded by single quotes. When it comes across a folder name such
>as: CD's, that seems to translate in the code to 'CD's', and the code
>chokes. Clicking the link does nothing, and reloading the file list can
>produce an "Error expecting ;" for every file or folder name that contains
>a single quote.


It's probably getting upset about the ' in CD's.

>Is there a simple way to fix this?


Rename the directory so that is doesn't contain a ' in the name. Maybe
to CDs instead.
--
Martin Jay
Phone/SMS: +44 7740 191877
 
Reply With Quote
 
 
 
 
CyberDroog
Guest
Posts: n/a
 
      07-14-2005
On Thu, 14 Jul 2005 18:14:01 +0100, Martin Jay <>
wrote:

>In message <>, CyberDroog
><> writes
>>At least I think it is... I have been playing with HttpFileServer
>>v2.0beta23 (http://www.rejetto.com/sw/) along with some user created
>>templates.

>
>[Snip]
>
>>The part: onclick="location.href='%item-url%' seems to be the problem since
>>it is surrounded by single quotes. When it comes across a folder name such
>>as: CD's, that seems to translate in the code to 'CD's', and the code
>>chokes. Clicking the link does nothing, and reloading the file list can
>>produce an "Error expecting ;" for every file or folder name that contains
>>a single quote.

>
>It's probably getting upset about the ' in CD's.


Yes, that is what I said is causing the problem.

>>Is there a simple way to fix this?

>
>Rename the directory so that is doesn't contain a ' in the name. Maybe
>to CDs instead.


Changing every file name on my system which contains a single quote
character isn't going to happen. It's just too common, especially in my
MP3 folders.

--
FAMOUS, adj. Conspicuously miserable.

- Ambrose Bierce

 
Reply With Quote
 
Robert Frost-Bridges
Guest
Posts: n/a
 
      07-14-2005
CyberDroog wrote:

> Changing every file name on my system which contains a single quote
> character isn't going to happen. It's just too common, especially in my
> MP3 folders.


I'm not sure what OS you're running but I wouldn't have thought batch
renaming of files would be too difficult. I'm on Linux myself and I should
imagine it's just a one-liner at the command prompt. (but don't ask me
what).

regards,
--
Robert
http://brightonfixedodds.net
 
Reply With Quote
 
Stan McCann
Guest
Posts: n/a
 
      07-14-2005
CyberDroog <> wrote in
news::

> At least I think it is... I have been playing with HttpFileServer
> v2.0beta23 (http://www.rejetto.com/sw/) along with some user created
> templates.
> The part: onclick="location.href='%item-url%' seems to be the
> problem since it is surrounded by single quotes. When it comes
> across a folder name such as: CD's, that seems to translate in the
> code to 'CD's', and the code chokes. Clicking the link does
> nothing, and reloading the file list can produce an "Error expecting
> ;" for every file or folder name that contains a single quote.
>
> Is there a simple way to fix this?
>


This is off topic for this group as it is not an HTML issue.

With that said, your fix is to rename the directories. Although some
OSes will let you get away with it, ' is not a valid character for file
names on some OSes. There are many symbols that are valid, but a good
rule of thumb to go by is to use letters, numbers, -, _ and . only.
Stick to those and you will rarely, if ever, have file name problems.

--
Stan McCann "Uncle Pirate" http://stanmccann.us/pirate.html
Webmaster/Computer Center Manager, NMSU at Alamogordo
http://alamo.nmsu.edu/ There are 10 kinds of people.
Those that understand binary and those that don't.
 
Reply With Quote
 
CyberDroog
Guest
Posts: n/a
 
      07-15-2005
On Thu, 14 Jul 2005 20:12:11 GMT, Robert Frost-Bridges
<> wrote:

>CyberDroog wrote:
>
>> Changing every file name on my system which contains a single quote
>> character isn't going to happen. It's just too common, especially in my
>> MP3 folders.

>
>I'm not sure what OS you're running but I wouldn't have thought batch
>renaming of files would be too difficult. I'm on Linux myself and I should
>imagine it's just a one-liner at the command prompt. (but don't ask me
>what).


I didn't mean to say it was difficult. I do batch renames all the time
because I'm kind of obsessive/compulsive about consistent and well-ordered
file names.

I meant to say that it's something I just won't do. A single quote
character is a legal character in a file name and I don't have any
intention of not using them because a bit of HTML can't deal with it.
I have other templates for HFS that work just fine.

I was just curious about the bit of code I posted. To fix it would, I
gather, require escaping the single quote characters that may appear in
file names. That's easy if the file names are explicitly defined. But
this is a variable - the code doesn't know if a file name will have a
single quote character, or how many of them.

--
I love deadlines. I love the whooshing sound they make as they fly by.

- Douglas Adams

 
Reply With Quote
 
CyberDroog
Guest
Posts: n/a
 
      07-15-2005
On 14 Jul 2005 13:15:58 -0700, Stan McCann <> wrote:

>CyberDroog <> wrote in
>news: :
>
>> At least I think it is... I have been playing with HttpFileServer
>> v2.0beta23 (http://www.rejetto.com/sw/) along with some user created
>> templates.
>> The part: onclick="location.href='%item-url%' seems to be the
>> problem since it is surrounded by single quotes. When it comes
>> across a folder name such as: CD's, that seems to translate in the
>> code to 'CD's', and the code chokes. Clicking the link does
>> nothing, and reloading the file list can produce an "Error expecting
>> ;" for every file or folder name that contains a single quote.
>>
>> Is there a simple way to fix this?
>>

>
>This is off topic for this group as it is not an HTML issue.
>
>With that said, your fix is to rename the directories. Although some
>OSes will let you get away with it, ' is not a valid character for file
>names on some OSes. There are many symbols that are valid, but a good
>rule of thumb to go by is to use letters, numbers, -, _ and . only.
>Stick to those and you will rarely, if ever, have file name problems.


On what OSes would a single quote be an illegal character in a file name?
These directories are on a Win2k3 Server, but I haven't had any problems
accessing them with any other version of Windows, or DOS, or Mandriva
Linux. Though with Linux I am using KDE. I can't recall if I've tried
playing with such a file on the command line.

Doesn't matter though. I like them the way they are.

The whole matter is academic really. I was just fiddling with a template
to see how it works and to figure out what to tweak to change features,
appearance, etc. As you pointed out, I know so little about it that I
wasn't aware that that portion of the code wasn't HTML. What is it,
javascript?

I suppose I can just dig in and rearrange the code such that the
%item-name% is no longer nested in quotes. That works fine in other
templates, though maybe because they are pure HTML.

--
"'Stupid' means one thing: threatening to the interests of the Democratic
Party. The more Conservative the Republican, the more vicious and
hysterical the attacks on his intelligence will be."

- Ann Coulter

 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      07-15-2005
CyberDroog wrote:

> The part: onclick="location.href='%item-url%' seems to be the problem

since
> it is surrounded by single quotes.


onclick='location.href="%item-url%";' ?

Cheers
Richard.


 
Reply With Quote
 
CyberDroog
Guest
Posts: n/a
 
      07-15-2005
On Fri, 15 Jul 2005 06:43:43 GMT, "rf" <@invalid.com> wrote:

>CyberDroog wrote:
>
>> The part: onclick="location.href='%item-url%' seems to be the problem

>since
>> it is surrounded by single quotes.

>
>onclick='location.href="%item-url%";' ?


That just changes the error message (unterminated string literal).

I've been thinking that, since %item-name% is a variable in which there is
no telling whether is contains a single quote, or how many, maybe I need a
function to search through it and replace all instance of a single quote
with an escape sequence.

--
One of the annoying things about believing in free will and individual
responsibility is the difficulty of finding somebody to blame your problems
on. And when you do find somebody, it's remarkable how often his picture
turns up on your driver's license.

- P.J. O'Rourke

 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      07-15-2005
With neither quill nor qualm, CyberDroog quothed

> I've been thinking that, since %item-name% is a variable in which there is
> no telling whether is contains a single quote, or how many, maybe I need a
> function to search through it and replace all instance of a single quote
> with an escape sequence.


A regular expression replace would be a cinch.

--
Neredbojias
Contrary to popular belief, it is believable.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
firefox html, my downloaded html and firebug html different? Adam Akhtar Ruby 9 08-16-2008 07:55 PM
problem with index.html .(page is automatically gettin redirected to index.html) karthikeyavenkat Java 2 03-17-2005 10:01 PM
How do I identify word<html><html>other word? Laura Perl 1 06-04-2004 11:32 PM
how to redirect to a frames-based html page and load the right html when coming from an ASP.NET page Mark Kamoski ASP .Net 1 08-13-2003 05:51 AM
How to use HTML::Parser to remove HTML tags and print result Mitchua Perl 1 07-15-2003 02:02 PM



Advertisments