You are here: Re: non-utf characters and XML « PHP Programming Language « IT news, forums, messages
Re: non-utf characters and XML

Posted by Martin Mandl - m2m tech support on 11/08/07 07:10

On Nov 8, 7:02 am, Toine <bapo...@gmail.com> wrote:
> Hello,
>
> My problem:
> I'm using PHP to dynamically create an XML document. However, some of
> my data (from MySQL) contains non-UTF characters such as the umlaut.
> Naturally, browsers like IE 7 throw an error when attempting to parse
> these characters. I understand that these characters are invalid for
> XML.
>
> My question:
> What is the best to handle these characters when creating XML
> documents on the fly? It seems like searching and replacing these
> characters would be complicated, and there must be an easier way.
>
> Thanks!

Actually Umlauts are in UTF-8. But you should tell your browser which
character set you are using.
You could do that in the xml header, e.g.
<?xml version="1.0" encoding="utf-8"?>

or set it in the header using php, e.g.
header('content-type: text/html; charset=utf-8');

which is basically the same as the meta tag
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">

or let .htaccess do the job, e.g.
AddCharset utf-8 .css .html .xhtml .xml .php

good luck
Martin


------------------------------------------------
online accounting on bash bases
Online Einnahmen-Ausgaben-Rechnung
http://www.ea-geier.at
------------------------------------------------
m2m server software gmbh
http://www.m2m.at

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация