473,811 Members | 3,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pear class Config.php and UTF-8

Hi!

I tried to use the PEAR class Config.php to parse a XML configuration
file which looks like

<?xml version="1.0" encoding="utf-8"?>
<configuratio n>
<section>
<item1>value1 </item1>
<item2>value2 </item2>
<item3>¤</item3> <--- EURO sign
</section>
</configuration>

The file has been saved as UTF-8 without signature (BOM). (If a BOM is
used, an error message appears saying, that the XML document is empty.
So that will not be the solution.)

If I use the following PHP script to parse the XML file, a "?" will be
displayed instead of the EURO sign:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<?php
require_once 'Config.php';
$config =& new Config ();
@$root =& $config->parseConfig ('config.xml', 'XML');
if (PEAR::isError ($root))
{
die ('Error while reading configuration: ' . $root->getMessage() );
}
$settings = $root->toArray ();
echo ($settings['root']['configuration']['section']['item3']);
?>
</body>
</html>

Replacing the Euro sign by "äöüß", Firefox 1.5 displays four question
marks in a diamond, Internet Explorer two different squares followed by
"/body>".

How can I avoid these errors? Is there a general problem using PEAR
class Config.php???

Kind regards,
Werner
Jan 1 '06 #1
0 1601

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

Similar topics

0
2132
by: Charlie Smith | last post by:
Hello All I'm writing a little app for my personal use and want to store the configuration data in an xml file. I found PEAR::Config that lets me read the config data into my app. But so far, I haven't figured out how to get modifcations back to the xml file. Here's what I've got so far. I ran across this basic code in an article at DevShed.
0
1396
by: Jan Pieter Kunst | last post by:
Dear group, I'm trying to change PEAR's default cache directory (on Mac OS X) from /tmp/pear/cache to /var/tmp/pear/cache, but I can't do it. I'm using the Marc Liyanage's php distribution, and I'm executing the correct binary: the one in /usr/local/php/bin. ---------------------------------------------------------------- % pear config-show
13
4126
by: Wolfgang May | last post by:
Hi, I have a problem with the HTTP implementation of the PEAR package: I try to PUT an XML instance to an XML database (eXist), but it always puts a binary: <?php require_once "HTTP/Request.php"; $URL = 'http://ap34.ifi.informatik.uni-goettingen.de:8081/exist/servlet/db/may/hamlet.xml';
2
1582
by: Sarah | last post by:
I'm having problems getting the FormBuilder package to work. I've spent the last 3hrs reading what little documentation and examples I could find and the idea seems great, if only it'll actually display a form. I'm not getting any error message, and I know that my DB_DataObjects are working as I'm able to auto generate the classes and search them. However using the following code which I believe is meant to display a form for the...
0
1650
by: Christian Decker | last post by:
Hi, I'm pretty new to Object Oriented design in PHP (although I'm using PHP since a long time, and I also code with Java, so this is not a problem for me) and I need some help with PEAR::DataObject (http://pear.php.net/package/DB_DataObject). I tried several times to get it to run but there seem to be some concepts that I can't get... I can't even use the Factory to build an object since I get the following error:
2
3054
by: David | last post by:
I have a book which had code that includes the line: require 'DB.php'; I know that this is from the PEAR code modules, but when I downloaded them and unpacked the directory, they "DB.php" module does not exist. Is this out of date or do I need to go somewhere else to get this extra module? Thanks
10
3492
by: Not Available | last post by:
On the host server: namespace JCart.Common public class JCartConfiguration : IConfigurationSectionHandler private static String dbConnectionString; public static String ConnectionString { get { return dbConnectionString;
0
1672
by: Tom | last post by:
I'm using the DB_DataObject script createTables.php to auto-generate the necessary database schema on two databases. Using the .ini approach (not the in-line PHP approach) to configure DB_DataObject in my script. Everything is by the book, but I'm having a big problem: Here's my main.ini file: database_one = mysql://user:password@localhost/one database_two = mysql://user:password@localhost/one
0
1609
by: AndrewJ | last post by:
I am having problem decoding data which is imported into a MySQL 4.0.* DB (thus no UTF-8 character set encoding possible) Basically my application utilises PEAR for DB abstraction. I import data from an EXCEL file directly into the DB. The data is imported correctly, i.e. I do not want it encoded in the DB. I want it imported directly with the special characters intact. So ë remains ë! When I retrieve the Data it is not displaying...
0
9726
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
10647
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...
1
10395
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
9204
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7667
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
6887
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3017
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.