follow us on google+ follow us feedburner


Go to Topic: PreviousNext
Go to: Message ListNew TopicSearchLog InPrint View

htmlentities doesn't work!

November 14, 2012 04:31PM
Hello Dear Reader!

In my case the PHP function htmlentities($str) doesn't work with EasyPHP 12.1. It returns the argument until $str contains german Umlaute (ä, ö, ü, Ä, Ö, Ü, ß); in this case htmlentities() doesn't replace them by ä etc., but returns a completely EMPTY string! Other special characters like " are replaced in the correct way (").

This error is completely new. I've never seen this in former versions of EasyPHP (up to 3.9.1). This function is very important for a well-designed website and i use it for nearly every alphanumeric output. Maybe this mistake will occour in other languages, too...

Can anyone help me? - Thank you!
Options: ReplyQuote
November 14, 2012 05:34PM
Hello again,

the problem also occurs with other signs like €, ½, ©, ¿, à, á, â, ã, ä, å.

Options: ReplyQuote
Posted by: Russell
November 14, 2012 09:04PM
Could this be due to EasyPHP12.1 using PHP 5.4 whereas your other versions all used an older version.

See the php docs for a description on how htmlentities() has changed in 5.4


Try specifying the encoding parameter to be 'ISO-8859-1'.

Hope that helps.
Options: ReplyQuote
November 16, 2012 06:09PM
Thank you very much, Russell! htmlentities($str, ENT_QUOTES ,'ISO-8859-1') does exactly what htmlentities($str) did before PHP 5.4.

But this is a really bad surprise. I had not expected this and must now change any program that I've written in the past decade. PHP for me was always a part of the "good", but now I feel treated like I was accustomed from MS, Apple or Adobe.
Options: ReplyQuote
Posted by: Daniel
November 26, 2012 05:14PM
I am very disappointed too to discover that I have to add
,ENT_QUOTES ,'ISO-8859-1'
in all the lines I have written till today.
Please fix that
Options: ReplyQuote
Posted by: Russell
November 27, 2012 12:31PM
Since its a change by the PHP Group, I think you best take the problem up with them as the authors of EasyPHP are powerless in this aspect.
Options: ReplyQuote

Go to: Message ListSearchLog In
Your Name: 
Your Email: 
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.