Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #6621
| From | "Peter H. Coffin" <hellsop@ninehells.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: decode encoded url |
| Date | 2012-07-17 09:56 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <slrnk0av9c.h39.hellsop@nibelheim.ninehells.com> (permalink) |
| References | <1aba2dd9-81aa-40fd-8ea4-a8fdb966593c@googlegroups.com> <ju35kn$h9d$1@dont-email.me> <ju3o3o$mce$1@dont-email.me> <2e93b482-35a7-4073-8638-ecb6b08c9b4a@googlegroups.com> <50057409$0$6981$e4fe514c@news2.news.xs4all.nl> |
On Tue, 17 Jul 2012 16:17:45 +0200, Erwin Moller wrote:
> On 7/17/2012 3:57 PM, cerr wrote:
>> On Tuesday, July 17, 2012 6:08:05 AM UTC-7, Jerry Stuckle wrote:
>>> 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().
>>
>> But when I name the file
>> men's_and_ladys'_nights.jpg (what erldecode() gives me), it doesn't work...
>>
>
>
> The string was 2 times encoded.
> Try to decode it again.
> echo urldecode("men's_and_ladys'_nights.jpg");
> gives
> men's_and_ladys'_nights.jpg
>
> I wonder why it was encoded like that?
Heh. You've SEEN what his editor does to quoting, and the lack of
concern exhibited over it... The double-encoding might well have been
caused just PASTING the single-encoded text.
--
_ o
|/)
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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