php-general Digest 16 Oct 2005 08:37:02 -0000 Issue 3740

Topics (messages 224189 through 224193):

Re: ampersand in dom with utf-8
        224189 by: Jasper Bryant-Greene
        224193 by: ac

RegEx - Is this right?
        224190 by: Gustav Wiberg
        224192 by: Al Hafoudh

Upgraded mail server today, testing functionality! (Sorry!)
        224191 by: Chris W. Parker

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
jonathan wrote:
So I'm reading up on character encoding in XML documents as I think this is the problem (after the many helpful suggestions on this list).

With regards to your second question; no, I'm not sure if I'm using proper utf-8 througout the entire process. When I input from the form I'm converting everything via htmlentities . This is why I'm getting è etc... (On a side note, is there a function or way to check to see if a form is using the native characters (from a copy and paste of a word document like è) or the HTML entity è .

If you're using the correct character set all the way through, you only need to do htmlspecialchars() to convert things like & and <, as all the other characters should already be present in the character set you are using (UTF-8). htmlentities() is mostly used for converting characters outside of your character set into entities.

I've changed the content-type from text/xml to application/xml but that doesn't seem to help.

As only UTF-8 and UTF-16 have to be supported, I'm concerned whether the processor might think it is some other encoding.

The HTTP headers are:

Date => Sat, 15 Oct 2005 17:49:02 GMT
Server => Apache/1.3.33 (Unix) mod_jk/1.2.8 PHP/5.0.4 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.7a
X-Powered-By => PHP/5.0.4
Cache-Control => no-cache
Connection => close
Content-Type => application/xml

header('Content-Type: text/xml; charset=UTF-8');

I guess pursuant to cc's suggestion, I should do an html_entity_decode when I make the xml document and then do another htmlentities on the html representatoin.

Shouldn't be any need. Characters like è don't have any special meaning in XML, and they can be represented in the UTF-8 character set, so there's no need to convert them to entities at any stage.

--
Jasper Bryant-Greene
General Manager
Album Limited

a: Freepost Album, PO Box 579, Christchurch 8015, New Zealand
p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303
e: [EMAIL PROTECTED]
w: http://www.album.co.nz/

Memberships:
* Institute of Electrical and Electronics Engineers (IEEE)
* Association for Computing Machinery (ACM)

--- End Message ---
--- Begin Message ---
try this,
if you need more entities to be included,
just refer to
`http://www.w3.org/2003/entities/iso8879/isolat1.ent' or find out its
charcode by yourself.

<?xml version="1.0"?>
<!DOCTYPE html [
 <!ENTITY egrave "&#x00e8;">
 <!ENTITY icirc "&#x00ee;">
]>
<item_name>farm lettuces with reed avocado, cr&egrave;me
 fra&icirc;che, radish and cilantro</item_name>


On 10/13/05, jonathan <[EMAIL PROTECTED]> wrote:
> I'm now getting this error:
>
> XML Parsing Error: undefined entity
>
> with the following entity at the first ampersand:
> <item_name>farm lettuces with reed avocado, cr&egrave;me
> fra&icirc;che, radish and cilantro</item_name>
>
> Why is an ampersand considered an undefined entity? The xml version
> is: <?xml version="1.0"?>
>
> Any thoughts please?
>
> -jonathan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
all born, to be dying

--- End Message ---
--- Begin Message ---
Hi there!

I want to get conents of a file and split into a array...

   $s = file_get_contents($fileName);
   $splitS = preg_split("/\n/",$s);

Is this equal to using $splitS = file($fileName) ?

/G
http://www.varupiraten.se/

--- End Message ---
--- Begin Message ---
yes, it is equal, but i'd rather use file() function


Gustav Wiberg wrote:

Hi there!

I want to get conents of a file and split into a array...

   $s = file_get_contents($fileName);
   $splitS = preg_split("/\n/",$s);

Is this equal to using $splitS = file($fileName) ?

/G
http://www.varupiraten.se/


--- End Message ---
--- Begin Message ---
I know I know I know. I don't like test message either but since I
started the upgrade I haven't received any new PHP mailings. Could be
just because of low traffic, but I need to make sure.

--- End Message ---

Reply via email to