473,387 Members | 3,801 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,387 software developers and data experts.

HTML aext area -> xml

Hi,

i have a strange problem and don't know where to look for the bug. Ok, i
have an html form witha text area.
Very roughly i make something like this (PHP 4.2.3, i can't update the
version):

------
$DomDocument = xmldoc('<'.'?xml version=\'1.0\'
encoding=\'ISO-8859-1\'?'.'><pages/>');

$root = $DomDocument->root();

$element = $DomDocument->create_text_node(utf8_encode($content));
//$content ist die Textarea
$root->add_child($element);

$handle1, $DomDocument->dumpmem("file.xml");
------

This works in every case. Especially the conversion of utf8 Strings and then
having a good ISO... file after the dump works in every case, until now with
my text area:

The file contains a lot of entities. The returns are displayed as etc.
But if i write $content into a file, everything is fine.
In the html form the character set is also set to iso-8859-1.

Where do the entities come from and how can i avoid them?

Regards,
Frank
Jul 17 '05 #1
2 1604
If you want to see a better method of dealing with multi-byte characters in
an XML file then take a look at
http://www.tonymarston.co.uk/php-mys...tml#multi-byte

You should also be aware that an XML file is only supposed to contain data,
not any HTML tags, which is why they are converted into entities.

When using an XML file in an XSL transformation all the HTML tags are
supposed to be generate by the XSL stylesheet and not ported across from the
XML data.

Tony Marston
http://www.tonymarston.net/

"Frank Thorstens" <Fr************@gmx.de> wrote in message
news:c0*************@ID-202045.news.uni-berlin.de...
Hi,

i have a strange problem and don't know where to look for the bug. Ok, i
have an html form witha text area.
Very roughly i make something like this (PHP 4.2.3, i can't update the
version):

------
$DomDocument = xmldoc('<'.'?xml version=\'1.0\'
encoding=\'ISO-8859-1\'?'.'><pages/>');

$root = $DomDocument->root();

$element = $DomDocument->create_text_node(utf8_encode($content));
//$content ist die Textarea
$root->add_child($element);

$handle1, $DomDocument->dumpmem("file.xml");
------

This works in every case. Especially the conversion of utf8 Strings and then having a good ISO... file after the dump works in every case, until now with my text area:

The file contains a lot of entities. The returns are displayed as etc. But if i write $content into a file, everything is fine.
In the html form the character set is also set to iso-8859-1.

Where do the entities come from and how can i avoid them?

Regards,
Frank

Jul 17 '05 #2
Hi,

thanks for your reply!
If you want to see a better method of dealing with multi-byte characters in an XML file then take a look at
http://www.tonymarston.co.uk/php-mys...tml#multi-byte
Hm, ok, so mb_convert_encoding($value,'UTF-8','ISO-8859-1');
works in another way than utf8_encode($value). ?
You should also be aware that an XML file is only supposed to contain data, not any HTML tags, which is why they are converted into entities.
That's clear, but why are the german Umlaute (ä, ö) encoded and also the
returns? Thats my main problem.
When using an XML file in an XSL transformation all the HTML tags are
supposed to be generate by the XSL stylesheet and not ported across from the XML data.


But i'm not using any XSL transformation. It's very strange. It seems to
have s.th to do with the data coming from the html form. :-/

Regards,
Frank
Jul 17 '05 #3

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

Similar topics

2
by: Mike Wilcox | last post by:
I have the following two files used to insert data into a database. when meinsert.php is executed a blank record is inserted in the database as if the .php file is not receiving the variables. ...
1
by: dSchwartz | last post by:
I am creating a totally adminable news system in asp.net (C#, SQL server). what i want to accomplish is allow multiple news templates to be read by an admin area. heres how it works...
33
by: LRW | last post by:
http://gto.ie-studios.net/index.php When you view the above site in IE, if the 1st of the three product images is tall enough to push the cell down a couple of pixels, IE somehow doesn't show...
6
by: SRafiq | last post by:
Hi I need help with a topic I have an html page and in it i have a textarea which can have a multiple of info, is there any possible way that i can out put a specific area of the textarea using...
10
by: Jake Barnes | last post by:
This weekend I wanted to learn AJAX, so I set up a little toy page where I could experiment. The idea of this page is that you click in one of the boxes to get some controls, at which point you can...
1
by: Jason Ho | last post by:
Hi All, In web page, we can make a HTML Area text box for user to input content (e.g. text, font size, picture) and switch to HTML code with some WYSIWYG control. I am writing a VB.NET...
1
Haitashi
by: Haitashi | last post by:
Hi guys! First off let me explain that I know it's not possible to output html in a text area and expect it to appear rendered. =) I'm trying to come up with a solution. Basically, I...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
1
by: phpmagesh | last post by:
Hi All, I have problem in the html page I have flash banner at the top of the page and i have menu in the same flash. this flash will cover the content area. so to access content area i used...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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.