Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6625

Re: decode encoded url

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: decode encoded url
Date 2012-07-17 15:26 -0400
Organization A noiseless patient Spider
Message-ID <ju4e9p$90b$1@dont-email.me> (permalink)
References <1aba2dd9-81aa-40fd-8ea4-a8fdb966593c@googlegroups.com> <ju35kn$h9d$1@dont-email.me> <ju3o3o$mce$1@dont-email.me> <qb0b08ho48ap8606seih63pg1r11nineqm@mfesser.de>

Show all headers | View raw


On 7/17/2012 11:18 AM, Michael Fesser wrote:
> .oO(Jerry Stuckle)
>
>> On 7/17/2012 3:52 AM, "Álvaro G. Vicario" wrote:
>>> El 17/07/2012 7:47, cerr escribió/wrote:
>>>> I have a url that refers to a css background like:
>>>> url(./sites/all/themes/marinelli/img/backgrounds/men&#039;s_and_ladys&#039;_nights.jpg);
>>>>
>>>> But now I'm wondering how I possibly should name that file or how i
>>>> can decode this string to a url the filesystem & the browser can read?
>>>
>>> If the string is supposed to be HTML, you need to convert it into plain
>>> text. It can be extremaly tricky becase the two most obvious functions
>>> don't seem to work as advertised:
>>>
>>> http://es.php.net/manual/en/function.html-entity-decode.php
>>> http://es.php.net/manual/en/function.htmlspecialchars-decode.php
>>>
>>> Another alternative is to use mb_convert_encoding():
>>>
>>> <?php
>>> $html =
>>> 'url(./sites/all/themes/marinelli/img/backgrounds/men&#039;s_and_ladys&#039;_nights.jpg);';
>>>
>>> var_dump(mb_convert_encoding($html, 'UTF-8', 'HTML-ENTITIES'));
>>>
>>> Then, it's pretty straightforward to create the file.
>>>
>>>
>>> If the string is supposed to be plain text already, I see no problem.
>>>
>>>
>>
>> It's a URL, so the correct function to use would be urldecode().
>
> This is not a URL encoding, but HTML character references.
>
> Micha
>

Ah, you're right.  I got caught up in the fact it was in a URL.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

decode encoded url cerr <ron.eggler@gmail.com> - 2012-07-16 22:47 -0700
  Re: decode encoded url "J.O. Aho" <user@example.net> - 2012-07-17 09:00 +0200
  Re: decode encoded url "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-07-17 09:52 +0200
    Re: decode encoded url cerr <ron.eggler@gmail.com> - 2012-07-17 06:04 -0700
      Re: decode encoded url Christoph Becker <cmbecker69@gmx.de> - 2012-07-17 17:41 +0200
      Re: decode encoded url "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-07-18 10:29 +0200
    Re: decode encoded url Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-17 09:08 -0400
      Re: decode encoded url cerr <ron.eggler@gmail.com> - 2012-07-17 06:57 -0700
        Re: decode encoded url Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-07-17 16:17 +0200
          Re: decode encoded url "Peter H. Coffin" <hellsop@ninehells.com> - 2012-07-17 09:56 -0500
      Re: decode encoded url Michael Fesser <netizen@gmx.de> - 2012-07-17 17:18 +0200
        Re: decode encoded url Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-17 15:26 -0400

csiph-web