473,395 Members | 1,541 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,395 software developers and data experts.

DOM : special chars (entities) in attributes

Hi,
I currently use the DOM from PHP5 to create XHTML documents.
I have a problem with entities. I would like to create a node :
<input id="place" value="café rouge">
To do that I simply create the node with createElement, and then :
$node -> setAttribute ("value", $val);
If I set $val = "café rouge", the saveXML causes PHP to fail with an
error message. The accentuated character seems to be a problem.
If I set $val = "caf&eacute; rouge", saveXML automatically replaces
the & with &amp; and that's not what I expect either.
Any idea ?
Thanks
Jul 17 '05 #1
2 2521
On 13 Feb 2005 05:50:26 -0800, ja************@tele2.fr (Jamais-Content) wrote:
I currently use the DOM from PHP5 to create XHTML documents.
I have a problem with entities. I would like to create a node :
<input id="place" value="café rouge">
To do that I simply create the node with createElement, and then :
$node -> setAttribute ("value", $val);
If I set $val = "café rouge", the saveXML causes PHP to fail with an
error message. The accentuated character seems to be a problem.
If I set $val = "caf&eacute; rouge", saveXML automatically replaces
the & with &amp; and that's not what I expect either.
Any idea ?


Perhaps the same as:

http://groups-beta.google.com/group/...3c4f0d12e093fc

i.e. you need to utf8 encode before passing to the DOM functions.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2
Thanks with utf8_encode('café rouge') it works well !
Jul 17 '05 #3

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

Similar topics

6
by: Jonas Meurer | last post by:
hello, my script selects a comment saved as VARCHAR in MySQL and displays it inside an html page. the problem is, that the comment contains several special characters, as mysterious utf-8...
6
by: Horst Gutmann | last post by:
Hi :-) I currently have quite a big problem with minidom and special chars (for example &uuml;) in HTML. Let's say I have following input file:...
3
by: Kunle Odutola | last post by:
I have a database that tracks players for children's sports clubs. I have included representative DDL for this database at the end of this post. A single instance of this database supports...
5
by: Pieter Linden | last post by:
Hi, This question refers sort of to Rebecca Riordan's article on Access web about subclassing entities: http://www.mvps.org/access/tables/tbl0013.htm How practical is this? I am writing a...
1
by: Robert Dodier | last post by:
Hello, Sorry for asking what must be a FAQ, but I wasn't able to find the answer. I have an XML document fragment which I want to store as a text string. I want a function to convert any XML...
6
by: bruce | last post by:
hi... i'm running into a problem where i'm seeing non-ascii chars in the parsing i'm doing. in looking through various docs, i can't find functions to remove/restrict strings to valid ascii...
25
by: Wim Cossement | last post by:
Hello, I was wondering if there are a few good pages and/or examples on how to process form data correctly for putting it in a MySQL DB. Since I'm not used to using PHP a lot, I already found...
2
by: Diilb | last post by:
I am using DOM to create an rss feed. The problem I am running into is "special characters" such as é è ç. If I try adding them to the XML as character data (CData), DOM chokes and throws out...
2
by: Lupus | last post by:
Hi everyone, I've got a problem with a piece of javascript code which parses a string. The problem occurs when the string contains some special characters like é, è, ü... There are 2 symptoms...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
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...

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.