FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Problem with special char in MySQL and XML
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Problem with special char in MySQL and XML [message #174849 is a reply to message #174847] Wed, 13 July 2011 12:42 Go to previous messageGo to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma:
Senior Member
.oO(Sarah)

> I try to resume, for try to find my error.
>
> I've a DB with UTF_8 encode
>
> I've saved char as & è à ' ì
> is this OK?? Or Do I've save char with this ecode &(space)amp;
> etcc....??? I mean: can I use è à ò ù & in my UTF_8 DB Table???

Yes, that's what UTF-8 is for. You can (and should!) store every char
literally and _not_ as character references like the &-thing.

> Now I've to read from table and show results in XML. Do I've to change
> results that I've in DB, or keep in my format?

XML uses UTF-8 by default, so you can directly output your text. But
there's still a handful of special characters that need to be written as
entity references, for example the ampersand '&'. If this char appears
unescaped in your text, it will break your XML.

In your code example from your first posting there was something like:

… strip_tags(utf8_encode(…))

I don't think either of them is necessary. Take your DB data, pass it
through htmlspecialchars() and take the result to build your XML.

Micha
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: xml rpc request with mynewsletter builder
Next Topic: how to implement AJAX to html
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 16:24:56 GMT 2024

Total time taken to generate the page: 0.04484 seconds