• Re: How to link to a file with ampersand in its name

    From Lew Pitcher@21:1/5 to The Natural Philosopher on Sat Sep 7 18:08:01 2024
    On Sat, 07 Sep 2024 18:59:11 +0100, The Natural Philosopher wrote:

    I have a file that has to be called U&blah.png

    I cannot find any way to direct the browser to load it

    U&ampblah.png doesnt work
    U%26blah.png doesnt work

    Using php rawurlencode doesnt work. It effectively does nothing

    Any ideas?

    This does not /directly/ address your issue, but....

    Can you not create a filesystem (hard/soft)link to the file,
    such that the (hard/soft)link /does not/ include the ampersand,
    and then use /that/ filename in your html?

    Something like
    ln -s 'U&blah.png' U_blah.png
    ...
    <img src="U_blah.png"/>

    ?

    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to All on Sat Sep 7 18:59:11 2024
    I have a file that has to be called U&blah.png

    I cannot find any way to direct the browser to load it

    U&ampblah.png doesnt work
    U%26blah.png doesnt work

    Using php rawurlencode doesnt work. It effectively does nothing

    Any ideas?


    --
    Any fool can believe in principles - and most of them do!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Andy Burns on Sat Sep 7 19:05:54 2024
    On Sat, 07 Sep 2024 19:44:30 +0100, Andy Burns wrote:

    The Natural Philosopher wrote:

    I have a file that has to be called U&blah.png

    I cannot find any way to direct the browser to load it

    U&ampblah.png doesnt work
    U%26blah.png doesnt work

    Using php rawurlencode doesnt work. It effectively does nothing

    Any ideas?
    http://localhost/U%26blah.txt

    works here (both with IIS on win11 and apache on Fedora)

    With test files white_grapes.png and white&grapes.png
    (where white_grapes.png is a symlink to white&grapes.png)
    both
    <img src="white_grapes.png" />
    and
    <img src="white&grapes.png" />
    produced proper images in Firefox, from an apache server


    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to The Natural Philosopher on Sat Sep 7 19:44:30 2024
    The Natural Philosopher wrote:

    I have a file that has to be called U&blah.png

    I cannot find any way to direct the browser to load it

    U&ampblah.png doesnt work
    U%26blah.png doesnt work

    Using php rawurlencode doesnt work. It effectively does nothing

    Any ideas?
    http://localhost/U%26blah.txt

    works here (both with IIS on win11 and apache on Fedora)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to The Natural Philosopher on Sat Sep 7 19:03:32 2024
    The Natural Philosopher <tnp@invalid.invalid> wrote:
    I have a file that has to be called U&blah.png

    I cannot find any way to direct the browser to load it

    U&ampblah.png doesnt work

    You have a syntax error above. An encoded ampersand is &amp;
    The trailing semicolon is part of the encoded value.

    You need U&amp;blah.png inside the src="" attribute.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Carlos E.R.@21:1/5 to The Natural Philosopher on Sat Sep 7 21:27:17 2024
    On 2024-09-07 19:59, The Natural Philosopher wrote:
    I have a file that has to be called U&blah.png

    I cannot find any way to direct the browser to load it

    U&ampblah.png doesnt work
    U%26blah.png doesnt work

    Using php rawurlencode doesnt work. It effectively does nothing

    Any ideas?

    I copied a jpg file and renamed it "U&blah.jpg"

    On the command line, this works:

    w3m U\&blah.jpg

    This is direct loading, bypassing apache.


    If I put the file in apache path, it also works.


    cer@Telcontar:/srv/www/home/cer/ampersand> l
    total 12
    drwxr-xr-x 2 cer users 4096 Sep 7 21:00 ./
    drwxr-xr-x 5 cer root 4096 Sep 7 21:07 ../
    -rw-r--r-- 1 cer users 3402 Sep 7 21:00 U&blah.jpg cer@Telcontar:/srv/www/home/cer/ampersand>


    The command "w3m http://localhost/~cer/ampersand" displays the page:

    Index of /~cer/ampersand

    Icon Name Last modified Size Description ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    [PARENTDIR] Parent Directory -
    [IMG] U&blah.jpg 2024-09-07 21:00 3.3K ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━


    Apache/2.4.51 (Linux/SUSE) Server at localhost Port 80


    And hitting enter on the file displays the photo it contains (it calls imagemagick, as w3m is a text mode web browser).


    Then I tried with firefox, and it also works.

    http://localhost/~cer/ampersand/U&blah.jpg

    So, no problem! :-)



    Oh, I also added a photo with png extension, no problem.


    http://localhost/~cer/ampersand/x&inesnap-20020308-195150-1.png




    Did I misunderstand something?


    --
    Cheers, Carlos.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Lew Pitcher on Sat Sep 7 19:33:15 2024
    On Sat, 07 Sep 2024 19:05:54 +0000, Lew Pitcher wrote:

    On Sat, 07 Sep 2024 19:44:30 +0100, Andy Burns wrote:

    The Natural Philosopher wrote:

    I have a file that has to be called U&blah.png

    I cannot find any way to direct the browser to load it

    U&ampblah.png doesnt work
    U%26blah.png doesnt work

    Using php rawurlencode doesnt work. It effectively does nothing

    Any ideas?
    http://localhost/U%26blah.txt

    works here (both with IIS on win11 and apache on Fedora)

    With test files white_grapes.png and white&grapes.png
    (where white_grapes.png is a symlink to white&grapes.png)
    both
    <img src="white_grapes.png" />
    and
    <img src="white&grapes.png" />
    produced proper images in Firefox, from an apache server

    Also
    http://host/white&grapes.png
    resolves to the proper image when entered in the URL bar
    of Firefox (again, image served by an apache server on Linux)


    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to Lew Pitcher on Sat Sep 7 20:16:13 2024
    Lew Pitcher wrote:

    both
    <img src="white_grapes.png" />
    and
    <img src="white&grapes.png" />
    produced proper images in Firefox, from an apache server
    to the o/p, is the filename exactly what you think it is?

    ls -b U* | hexdump -C

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to The Natural Philosopher on Sat Sep 7 23:49:11 2024
    On Sat, 7 Sep 2024 18:59:11 +0100, The Natural Philosopher wrote:

    I have a file that has to be called U&blah.png

    I cannot find any way to direct the browser to load it

    Tried:

    touch 'U&blah.png'
    firefox U\&blah.png

    And a Firefox tab appeared with “file:///«path»/U&blah.png” in its address bar, and a message saying the image couldn’t be displayed
    because it had errors (of course, being a zero-length file).

    Or is this supposed to work through a web server?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to Andy Burns on Sun Sep 8 13:45:57 2024
    On 07/09/2024 19:44, Andy Burns wrote:
    The Natural Philosopher wrote:

    I have a file that has to be called U&blah.png

    I cannot find any way to direct the browser to load it

    U&ampblah.png doesnt work
    U%26blah.png doesnt work

    Using php rawurlencode doesnt work. It effectively does nothing

    Any ideas?
    http://localhost/U%26blah.txt

    works here (both with IIS on win11 and apache on Fedora)

    Works here too when I actually point the browser at the development
    server, not the old server.
    I feel a trife ashamed....

    --
    "It is an established fact to 97% confidence limits that left wing
    conspirators see right wing conspiracies everywhere"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Carlos E.R.@21:1/5 to The Natural Philosopher on Sun Sep 8 15:06:40 2024
    On 2024-09-08 14:45, The Natural Philosopher wrote:
    On 07/09/2024 19:44, Andy Burns wrote:
    The Natural Philosopher wrote:

    I have a file that has to be called U&blah.png

    I cannot find any way to direct the browser to load it

    U&ampblah.png doesnt work
    U%26blah.png doesnt work

    Using php rawurlencode doesnt work. It effectively does nothing

    Any ideas?
    http://localhost/U%26blah.txt

    works here (both with IIS on win11 and apache on Fedora)

    Works here too when I actually point the browser at the development
    server, not the old server.
    I feel a trife ashamed....

    No problem -- Issue explained :-)

    --
    Cheers, Carlos.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to Lew Pitcher on Sun Sep 8 13:47:24 2024
    On 07/09/2024 20:33, Lew Pitcher wrote:
    On Sat, 07 Sep 2024 19:05:54 +0000, Lew Pitcher wrote:

    On Sat, 07 Sep 2024 19:44:30 +0100, Andy Burns wrote:

    The Natural Philosopher wrote:

    I have a file that has to be called U&blah.png

    I cannot find any way to direct the browser to load it

    U&ampblah.png doesnt work
    U%26blah.png doesnt work

    Using php rawurlencode doesnt work. It effectively does nothing

    Any ideas?
    http://localhost/U%26blah.txt

    works here (both with IIS on win11 and apache on Fedora)

    With test files white_grapes.png and white&grapes.png
    (where white_grapes.png is a symlink to white&grapes.png)
    both
    <img src="white_grapes.png" />
    and
    <img src="white&grapes.png" />
    produced proper images in Firefox, from an apache server

    Also
    http://host/white&grapes.png
    resolves to the proper image when entered in the URL bar
    of Firefox (again, image served by an apache server on Linux)


    Yeah apologies all round. I was making changes to the development server
    while testing on the old server.


    --
    "It is an established fact to 97% confidence limits that left wing
    conspirators see right wing conspiracies everywhere"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From rbowman@21:1/5 to The Natural Philosopher on Sun Sep 8 17:45:51 2024
    On Sun, 8 Sep 2024 13:47:24 +0100, The Natural Philosopher wrote:

    Yeah apologies all round. I was making changes to the development server while testing on the old server.

    I've never, ever done anything like that :) It does tend to make you doubt
    your sanity.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to rbowman on Sun Sep 8 19:40:59 2024
    On 08/09/2024 18:45, rbowman wrote:
    On Sun, 8 Sep 2024 13:47:24 +0100, The Natural Philosopher wrote:

    Yeah apologies all round. I was making changes to the development server
    while testing on the old server.

    I've never, ever done anything like that :) It does tend to make you doubt your sanity.

    The setup here is rather peculiar. Depending on what port (80 or 443)
    you select you get a completely different server.

    That isn't a long term solution, it's just how it is for development


    --
    In todays liberal progressive conflict-free education system, everyone
    gets full Marx.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)