473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

html entities and ampersands

my php script gets delivered text that contains special chars (like
german umlauts), and these chars may, may partially or may not be
coverted into html entities already. i don't know beforhand.

question: how to spot wether an ampersand is just an ampersand and
needs to be converted or is part of an html entity and must be left
alone?

any help appreciated, micha

Jul 17 '05 #1
2 4969
micha wrote:
my php script gets delivered text that contains special chars (like
german umlauts), and these chars may, may partially or may not be
coverted into html entities already. i don't know beforhand.

question: how to spot wether an ampersand is just an ampersand and
needs to be converted or is part of an html entity and must be left
alone?

any help appreciated, micha


http://ch2.php.net/html_entity_decode

Have PHP decode the entities, the remaining ampersands should be just
ampersands.

--
Markus
Jul 17 '05 #2

Markus Ernst wrote:
micha wrote:
my php script gets delivered text that contains special chars (like
german umlauts), and these chars may, may partially or may not be
coverted into html entities already. i don't know beforhand.

question: how to spot wether an ampersand is just an ampersand and
needs to be converted or is part of an html entity and must be left
alone?

any help appreciated, micha
http://ch2.php.net/html_entity_decode

Have PHP decode the entities, the remaining ampersands should be just

ampersands.

--
Markus


yes, brilliant idea.
decode any present entities, than encode the whole thing again to get
any entity encoded (which is the aim, probably didn't become clear in
my 1st post).

micha

Jul 17 '05 #3

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

Similar topics

11
by: yawnmoth | last post by:
say i have a for loop that would iterate through every character and put a space between every 80th one, in effect forcing word wrap to occur. this can be implemented easily using a regular...
6
by: Horst Gutmann | last post by:
Hi :-) I currently have quite a big problem with minidom and special chars (for example ü) in HTML. Let's say I have following input file:...
0
by: Tag | last post by:
Altova StyleVision has good features for generating hyperlinks with both static and dynamic segments. But I don't quite see how to create an anchor in the same document, so I can, for example,...
17
by: mickjames | last post by:
Hi, I'd like to include the whole web page content (as opposed to just the headlines) into RSS/XML to enable people to read them via rss feed readers. Question: how to convert HTML elements...
5
by: ion | last post by:
Hi! I'm trying to do the simplest thing in the world, that is --> replace all characters with entities I saw the clever use of a string-replace template at...
23
by: John | last post by:
Last year, I remember finding a web page describing how to pass the name of a file to another web page, and have that web page load that image file. Now, I can't find my record of that (it was...
7
by: ian ward | last post by:
Hello, I want to show the result of some JavaScript on an HTML page. I've had a look at some threads and it seems the conclusion is the following - javascript entities are usable on the...
6
by: clintonG | last post by:
Can anybody make sense of this crazy and inconsistent results? // IE7 Feed Reading View disabled displays this raw XML <?xml version="1.0" encoding="utf-8" ?> <!-- AT&T HTML entities & XML...
6
by: Clodoaldo | last post by:
I was looking for a function to transform a unicode string into htmlentities. Not only the usual html escaping thing but all characters. As I didn't find I wrote my own: # -*- coding: utf-8...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.