473,819 Members | 3,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

htmlentities

tco
Hi all,

I'm searching a reverse function for htmlentities... . i couldn't find
anything in the manual and over forums :-/
does anyone have an idea ?

many thanks in advance,
--
tco
Jul 17 '05 #1
2 3704
tco wrote:
I'm searching a reverse function for htmlentities... . i couldn't find
anything in the manual and over forums :-/
does anyone have an idea ?


Very well hidden after the charsets table, you can find

<quote src="http://www.php.net/htmlentities">
If you're wanting to decode instead (the reverse) you can use
html_entity_dec ode().
</quote>

and you can find more about html_entity_dec ode @
http://www.php.net/html_entity_decode
#v+
<?php
$x = 'test <html parm="val"/> test';

$y = htmlentities($x );
$z = html_entity_dec ode($y);

echo "x=$x\ny=$y\nz= $z\n";
?>
#v-

The output is (I run PHP in command-line mode):
x=test <html parm="val"/> test
y=test &lt;html parm=&quot;val& quot;/&gt; test
z=test <html parm="val"/> test
-
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2
tco <tc*@nospam.org > wrote:
Hi all,

I'm searching a reverse function for htmlentities... . i couldn't find
anything in the manual and over forums :-/


from the manual:

html_entity_dec ode() is the opposite of htmlentities() in that it
converts all HTML entities to their applicable characters from string.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4983
by: Randell D. | last post by:
Folks, I'm using Apache/1.3.28 (SuSE 7.1, kernal 2.4) with PHP/4.3.2. I have the following code to help cleanse form data. function cleanData($sourceData, &$cleanData) { foreach($myData as $fieldName=>$fieldValue) { if(strlen($fieldValue)>0) { $cleanData=htmlentities(trim($fieldValue)); } else { $cleanData=""; }
6
2286
by: John Dunlop | last post by:
(Crossposted and followups set. Hope you don't mind Markus.) The Manual expresses the parameters of htmlentities as: string string ] http://www.php.net/manual/en/function.htmlentities.php The meaning is unambiguous: the first parameter, "string", must be present; the second parameter, "quote_style", is optional; and the
0
1699
by: Gandalf | last post by:
Hi all! I'm writting a web application using IIS and Python. I would like to have the Python equvalient of the PHP functions 'htmlentities' and 'htmlspecialchars'. E.g. to convert a' >>>> aacute; õ >>>> otilde; and the others. I looked for them in many libraries (urllib, htmllib, urlparse etc.) but I could only find the 'urlencode' function. I could not find anything on google ('python htmlentities equvalent'). Please
7
1919
by: Taras_96 | last post by:
Hi all, I was hoping to get some clarification on a couple of questions I have: 1) When should htmlspecial characters be used? As a general rule should it be used for text that may contain special characters that is going to be rendered in the browser (ie: text that isn't in tags)? I've got a javascript onclick handler whose code includes an ampersand and the HTML validator complains. I don't know if I should escape the ampersand, or...
2
1532
by: pittendrigh | last post by:
I have a forum where all user-supplied text (posted to the forum) is cleaned with htmlentities($msg) before sending it back to incoming GET requests. I want to allow image uploads to registered users. That much (allowing uploads if registered) is straightforward. But if all my user-supplied output is scrubbed with htmlentities first, then the img tags aren't tags, and no image will show.
3
4453
by: jl | last post by:
>From the php manual I copied and pasted this example: <?php $str = "A 'quote' is <b>bold</b>"; // Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt; echo htmlentities($str); // Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt; echo htmlentities($str, ENT_QUOTES);
2
2918
by: matthud | last post by:
<?php //MAKE IT SAFE $chunk = $_POST; $title = $_POST; $url = $_POST; $tags = $_POST; $user = $_POST; $safe_chunk = mysql_real_escape_string(htmlentities($chunk)); $safe_title = mysql_real_escape_string(htmlentities($title));
9
4350
nathj
by: nathj | last post by:
Hi, As you can tell by the subject of this post I'm having a spot of bother with htmlentities() and html_entity_decode(). I have built/am building a web site that allows user feedback. When the user enters their review of a resource it is stored in the database. It goes into a LONGTEXT field and what is entered is passed through htmlentities(): $reviewToStore = htmlentities($reviewEntered, ENT_QUOTES) ; The results in the database...
8
7931
by: mijn naam | last post by:
Can someone please explain to me why/when one would use htmlspecialchars instead of htmlentities? I know: if you only want to get certain characters translated. This is not the answer I'm looking for, I would like to know *why* you would want that, as opposed to a full translation.
0
9748
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9620
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10704
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10429
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10458
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10159
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7700
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5724
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.