LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-18-2005, 08:29 AM   #1
Boby
Member
 
Registered: Feb 2004
Posts: 781

Rep: Reputation: Disabled
MySQL to XML - charset problems


Hello!

I have to transfer all informations from a huge MySQL table to an XML file. The MySQL charset is ISO-8859-1 [german] . There are also some special characters, most of them are russian or bulgarian letters, <= in one character [I'm not able to display it here too], and so on. When I try to read from the XML file with an XML parser in PHP or just to display the file in Firefox or another browser, I get errors because of this chars. Is there a way to delete all this chars or replace them with good ones with an PHP script? I also tried to set the XML encoding to UTF-8 but I get the same errors.

Thank you!
Boby
 
Old 04-20-2005, 08:22 AM   #2
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Not sure about extended character sets offhand, but the following standard ASCII characters need to be translated as so:

< becomes &lt;
> becomes &gt;
& becomes &amp;amp;

For instance, if you have the following XML:
Code:
<blah>
    <b1>Me & You</b1>
    <b1>2 > 1</b1>
    <b1>2 < 4</b1>
</blah>
It would need to be encoded as so:
Code:
<blah>
    <b1>Me &amp;amp; You</b1>
    <b1>2 &gt; 1</b1>
    <b1>2 &lt; 4</b1>
</blah>
Edit: Had to encode my &amp;amp; twice above because the HTML was translating it!

Last edited by deiussum; 04-20-2005 at 08:25 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
experiences with embedded mysql? XML instead of a database? SerfurJ Programming 2 12-11-2004 08:06 AM
XML <->MySql in Perl?? rsz Programming 0 10-06-2004 09:40 AM
html, xml, php, mysql atheist Programming 8 06-07-2004 01:28 PM
C++ question: MySQL or XML? BlackT Programming 7 07-21-2003 07:46 AM
Charset in MySQL YMJ Programming 1 03-26-2003 03:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration