View previous topic :: View next topic |
Author |
Message |
yoxi Cipher
Joined: Sep 07, 2004 Posts: 1799 Location: Dawlish, Devon
|
Posted: Mon Feb 16, 2009 10:30 am Post subject: [img] with filenames including '&' character |
|
I tried embedding an inline image in a post, but all I got was the line of code instead of the image. Then I took the '&' out of the filename and it worked (once I'd taken it out of the linked filename as well, of course...)
example: [img]http://www.yoxi.net/anitya/f&r.jpg[/img]
If I took the & out, you'd see this image, but you should see it anyway, they're both available!
Has the forum never supported filenames containing ampersands, or is this something from the latest upgrade? I uses ampersands quite regularly in image names, and I'm sure this has never come up before.
- padmavyuha |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
Posted: Mon Feb 16, 2009 10:42 am Post subject: Re: [img] with filenames including '&' character |
|
yoxi wrote: | Has the forum never supported filenames containing ampersands, or is this something from the latest upgrade? I uses ampersands quite regularly in image names, and I'm sure this has never come up before. |
The "&" character is a reserved character for URLs in is not a limitation of this forum. The "&" character means that the next characters until the next ";" character are to be interpreted as special symbolic names. For example, ">" means ">". To put a literal "&" in a URL, put "&" in your URL.
Patrick |
|
Back to top |
|
|
yoxi Cipher
Joined: Sep 07, 2004 Posts: 1799 Location: Dawlish, Devon
|
Posted: Mon Feb 16, 2009 11:16 am Post subject: |
|
No, it's specific to this forum software - I've just tested the same img string over at forums.machtech.com and it works fine with the ampersand in.
- padmavyuha |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
Posted: Mon Feb 16, 2009 11:46 am Post subject: |
|
yoxi wrote: | No, it's specific to this forum software - I've just tested the same img string over at forums.machtech.com and it works fine with the ampersand in. |
You misunderstand me. the use of "&" as a special character is an HTTP standard set by W3C.org. Some forums don't test for it, our forum software complies more strictly with the standard.
You are assuming that your URLs are OK just because some sites guess correctly what you intended for your non-compliant URLs. However, not all browsers will make the same guess when they encounter your URLs which is why when I post URLs or new HTML pages, I run them through an HTML validator to detect stuff like this.
Patrick |
|
Back to top |
|
|
sardisson Town Crier
Joined: Feb 01, 2004 Posts: 4588
|
Posted: Mon Feb 16, 2009 11:56 am Post subject: Re: [img] with filenames including '&' character |
|
pluby wrote: | To put a literal "&" in a URL, put "&" in your URL. |
That doesn't seem to be working here, either.
Smokey _________________ "[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki |
|
Back to top |
|
|
yoxi Cipher
Joined: Sep 07, 2004 Posts: 1799 Location: Dawlish, Devon
|
Posted: Mon Feb 16, 2009 12:03 pm Post subject: |
|
Oh, okay, sorry - I was assuming their forum software was handling the ampersand more intelligently, rather than just ignoring it!
I am surprised this hasn't cropped up here before, as I do tend to use ampersands in filenames. Time to migrate to plusses, I suppose - funny, because I got out of the plus habit years ago when some system I was using at work didn't like filenames with plusses in them.
Omnia mutantur, nihil interit.
- padmavyuha |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
Posted: Mon Feb 16, 2009 12:03 pm Post subject: |
|
<img> |
|
Back to top |
|
|
yoxi Cipher
Joined: Sep 07, 2004 Posts: 1799 Location: Dawlish, Devon
|
Posted: Mon Feb 16, 2009 12:09 pm Post subject: |
|
?? |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
Posted: Mon Feb 16, 2009 12:26 pm Post subject: |
|
I was trying out using the HTML "img" tag as a workaround as the bad news is that the phpNuke software's tag search and replace code apparently gets confused by the "&" in an "img" block and using the HTML "img" tag does not work either.
I tried to see if there was an obvious place in the phpNuke code that I could change to fix this, but I found none. So, unfortunately, this is just a limitation that we are stuck with.
Patrick |
|
Back to top |
|
|
yoxi Cipher
Joined: Sep 07, 2004 Posts: 1799 Location: Dawlish, Devon
|
Posted: Mon Feb 16, 2009 12:27 pm Post subject: |
|
Meh - Mohammed, mountain... |
|
Back to top |
|
|
sardisson Town Crier
Joined: Feb 01, 2004 Posts: 4588
|
Posted: Mon Feb 16, 2009 5:56 pm Post subject: Re: [img] with filenames including '&' character |
|
Et voilà :
So, the solution seems to be to %-encode/escape the ampersand.
(UnicodeChecker's service would be lovely at this, except it believes that an & doesn't need to be %-escaped. I had to manually look up the hex for &, since it's not one of the 5 or so hex values I remember off the top of my head.)
As a side note, you also need to %-escape any unescaped UTF-8 URLs you copy from the wiki, e.g. any of the pages whose titles contain French accent grave ou accent aigu, or you won't be able to make URLs out of them here.
Smokey _________________ "[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
Posted: Mon Feb 16, 2009 6:08 pm Post subject: Re: [img] with filenames including '&' character |
|
sardisson wrote: | Et voilà :
So, the solution seems to be to %-encode/escape the ampersand. |
Excellent work! I was trying all sorts of stuff but I could not find anything that would get through phpNuke's code.
Patrick |
|
Back to top |
|
|
yoxi Cipher
Joined: Sep 07, 2004 Posts: 1799 Location: Dawlish, Devon
|
Posted: Tue Feb 17, 2009 12:56 am Post subject: |
|
Thanks, that's useful to know. For those of you watching in black & white, the code to replace an ampersand in a URL is %26, so in my img link, f&r.jpg should be f%26r.jpg instead.
- padmavyuha |
|
Back to top |
|
|
sardisson Town Crier
Joined: Feb 01, 2004 Posts: 4588
|
Posted: Thu Feb 26, 2009 11:44 pm Post subject: Re: [img] with filenames including '&' character |
|
sardisson wrote: | As a side note, you also need to %-escape any unescaped UTF-8 URLs you copy from the wiki, e.g. any of the pages whose titles contain French accent grave ou accent aigu, or you won't be able to make URLs out of them here. |
FWIW, unescaped accents apparently used to work before the forum upgrade, as I found this post from Jaqueline which I'm sure used to be a working link. I guess they made their URL "parsing" stricter in the new version.
Smokey _________________ "[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki |
|
Back to top |
|
|
OPENSTEP The One
Joined: May 25, 2003 Posts: 4752 Location: Santa Barbara, CA
|
Posted: Fri Feb 27, 2009 1:14 am Post subject: |
|
I'll take a look at the php and see if anything stands out. It also may be something with the encoding used by the database where, after the upgrade, something is expecting unicode vs. utf8 or something. I think the new code being stricter is a better possibility though.
ed |
|
Back to top |
|
|
|