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


Groups > comp.lang.php > #16811 > unrolled thread

htmlentities($dirs2[$i] not working

Started bysonnichjensen@gmail.com
First post2016-07-02 01:12 -0700
Last post2016-07-02 13:32 +0200
Articles 3 — 3 participants

Back to article view | Back to comp.lang.php


Contents

  htmlentities($dirs2[$i] not working sonnichjensen@gmail.com - 2016-07-02 01:12 -0700
    Re: htmlentities($dirs2[$i] not working "R.Wieser" <address@not.available> - 2016-07-02 11:23 +0200
      Re: htmlentities($dirs2[$i] not working "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-07-02 13:32 +0200

#16811 — htmlentities($dirs2[$i] not working

Fromsonnichjensen@gmail.com
Date2016-07-02 01:12 -0700
Subjecthtmlentities($dirs2[$i] not working
Message-ID<82cb6cae-3d18-4f71-bbc7-b5bcc706c364@googlegroups.com>
Hi 

A customers internet provider updated to the latest PHP version a week ago which caused quite some problems

one is tha htmlentities($dirs2[$i] does not longer work - it simply returns an empty string in case it contains ä ö or ü

Any idea why?

[toc] | [next] | [standalone]


#16812

From"R.Wieser" <address@not.available>
Date2016-07-02 11:23 +0200
Message-ID<57778797$0$5899$e4fe514c@news.xs4all.nl>
In reply to#16811
Sonnich(?),

> one is tha htmlentities($dirs2[$i] does not longer work - it
> simply returns an empty string in case it contains ä ö or ü
>
> Any idea why?

Because that is what the docs have specified for it to do when it encounters
illegal code unit sequences ?

As a first try I plugged "PHP 7 htmlentities"* into google, and the very
first result looked promising:
http://php.net/manual/en/function.htmlentities.php

*I used the generic PHP 7 ,  as you forgot to mention which sub version of
it exactly you're using/having problems with,  nor which version your client
upgraded from, which could be important too.

A bit down that page I found ENT_SUBSTITUTE, which mentions:

[quote]
Replace invalid code unit sequences .... with a Unicode Replacement
Character  INSTEAD OF RETURNING AN EMPTY STRING.
[/quote]

Also, this is, as the document shows, the behaviour as far back as PHP 4.

And by the way, I know very little about PHP, let alone about specific
versions.   My google-fu seems to be in working order though. :-)

Regards,
Rudy Wieser


-- Origional message:
<sonnichjensen@gmail.com> schreef in berichtnieuws
82cb6cae-3d18-4f71-bbc7-b5bcc706c364@googlegroups.com...
Hi

A customers internet provider updated to the latest PHP version a week ago
which caused quite some problems

one is tha htmlentities($dirs2[$i] does not longer work - it simply returns
an empty string in case it contains ä ö or ü

Any idea why?

[toc] | [prev] | [next] | [standalone]


#16814

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2016-07-02 13:32 +0200
Message-ID<nl88ng$5eu$1@solani.org>
In reply to#16812
On 02.07.2016 at 11:23, R.Wieser wrote:

> <sonnichjensen@gmail.com> schreef in berichtnieuws
> 82cb6cae-3d18-4f71-bbc7-b5bcc706c364@googlegroups.com...
> 
>> one is tha htmlentities($dirs2[$i] does not longer work - it
>> simply returns an empty string in case it contains ä ö or ü
>>
>> Any idea why?
> 
> Because that is what the docs have specified for it to do when it encounters
> illegal code unit sequences ?

Yes, indeed.  The OP most likely faces the problem outlined in
<http://php.net/manual/en/migration54.incompatible.php#115441>.  The
solution is simple: just explicitly set the $encoding parameter to the
desired enconding, or as of PHP 5.6.0, to set the ini directive
default_charset to the desired value.

-- 
Christoph M. Becker

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web