FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » html entity double escaping (how to fix that)
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
html entity double escaping [message #168279] Mon, 08 April 2013 08:32 Go to next message
captain picard is currently offline  captain picard   Austria
Messages: 15
Registered: March 2013
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
hi there!

we cannot view these entities...

&
ß
'
&

because "&" is converted to "&" by default!

as i've seen and allready tried out in html mode, it works. but thats not the solution in this case! guess you're using the htmlentities() or htmlspecialchars() to escape those signs! please tell me where i can find the code where this replacement is done?

i would like to add the new parameter double_encode on using htmlentities(). this should fix this. htmlentities are not escaped twice then: & -!> & and will remain as & i hope...

thanks in advance
cheers,
dk

[Updated on: Mon, 08 April 2013 08:32]

Report message to a moderator

Re: html entity double escaping [message #168302 is a reply to message #168279] Sun, 14 April 2013 02:59 Go to previous messageGo to next message
naudefj is currently offline  naudefj   
Messages: 3631
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
Why don't you rather use the equivalent Unicode characters?

Anyway, if you insist you can change tags_to_html() in post_proc.inc.t.
Aw: Re: html entity double escaping [message #168587 is a reply to message #168302] Tue, 28 May 2013 03:11 Go to previous message
captain picard is currently offline  captain picard   Austria
Messages: 15
Registered: March 2013
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Thanks, I did so.
It's working now as expected for me!

Inserting unicode characters would need a complete map, sometimes i need things like ← → which are simple to remember.

changes:

$str = htmlspecialchars($str);

in tags_to_html() of forumcache/src/post_print.inc.t to the following

$str = htmlspecialchars($str, ENT_QUOTES | ENT_COMPAT | ENT_HTML401, "UTF-8", FALSE);
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: SQL optimization join
Next Topic: Using PHP can we create any mobile applications?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Dec 12 05:28:13 EST 2017

Total time taken to generate the page: 0.00800 seconds