View Full Version : encoding for sitmap

08-09-2007, 01:23 PM
I am dynamically creating a sitemap.xml to help google index my pages correctly. Because the sitemap will be generated by PHP and it has to be encoded in UTF-8. Is there any way i can get my PHP script to write the file in UTF-8

08-09-2007, 01:43 PM
Don't you just have your PHP script write something like this to a file?

This example is an XML for MP3 playlist, but the idea is that the first
line defines the encoding. The code itself is just a text file.

<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xml:lang="EN" version="2.0">
Everything in here

When that text file is read by the browser ... that's when it's encoded based on utf-8.

08-09-2007, 02:01 PM
Surley the text in the file has to be UTF-8

08-09-2007, 07:33 PM
Surley the text in the file has to be UTF-8


a text file is a text file is a text file ...

When a server opens a text file and sends it to a user's browser,
it is encoded by whatever encoding instructions it is given ...

See this site:

Create your own XML sitemap for your own site, then view the XML file.
Notice the very top line.

<?xml version="1.0" encoding="UTF-8" ?>
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
- <url>

The XML file itself is just a text file (ASCII).

Maybe you're talking about something I've never heard of?
Does anyone else know what I'm not seeing here?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum