I have a url in html:
<a href="index.php?q=event&id=56&date=128">
I need to turn it into a string exactly as:
<a href="index.php?q=event&id=56&date=128">
I know how to do this with preg_replace etc, but is there a function in php that deals directly with encoding that I can use for other encoding issues such as &nsbp (or whatever it is, etc)? Ideally I would send my string into the function and it would output '&' instead of &. Is there a universal function for converting &TEXT; into an actual character?
Edit: sorry, posted this before I finished typing the question. QUESTION is now complete.
Once you have encoded something, you need to store it and be able to recall it. Problems with these last two stages are associated with conditions like dementia. But for most younger people, the problem lies in the encoding. Doing too many things at once means we're not able to give proper attention to any one task.
The best way to attack the problem, as with many things in Python, is to be explicit. That means that every string that your code handles needs to be clearly treated as either Unicode or a byte sequence. The most systematic way to accomplish this is to make your code into a Unicode-only clean room.
Go to "File" -> "Options" -> "Advanced" and scroll down until the "General" section is reached. In the "General" section, check the box that says "Confirm file format conversion on open." Exit Word, and reopen the corrupt document again. The dialogue box will appear.
use html_entity_decode():
$newUrl = html_entity_decode('<a href="index.php?q=event&id=56&date=128">');
echo $newUrl; // prints <a href="index.php?q=event&id=56&date=128">
Use htmlspecialchars_decode. Example straight from the PHP documentation page:
$str = '<p>this -> "</p>';
echo htmlspecialchars_decode($str); // <p>this -> "</p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With