473,395 Members | 1,637 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.

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"?>
<configuration>
<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 1459

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

Similar topics

0
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,...
0
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...
13
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...
2
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...
0
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...
2
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"...
10
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...
0
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...
0
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...
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
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
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...
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
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.