SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XML Special characters / MySQL

    Hi !
    I'm a novice to mysql and do not have any idea about XML. The database I'm working on has been imported (somehow) form a XML file. Now all special characters are displayed in some kind of code within the database. For example a small e with accent (`) is 	

    Here are my questions:
    1. What kind of code is that?
    2. is there anyway to replace those characters with the actual special character? [ Otherwise all my cgi-scripts are worthless since they use the user name and definitely need the EXACT spelling of it..]


    It would be great if anyone of you could help me.

    Regards,
    John

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post examples of these characters as a plain text file on your server somewhere?

    Most probably somewhere along the export/import process UTF-8 data got "translated" into ASCII code.
    (most XML files are UTF-8)

    There are some online sites where you can decode such strings, or at least download character equivalent charts, or you could use a good desktop editor (XML Spy, BBEdit), or write a regex function in PHP. You'd then copy tables (make backups), run the content through the transformer script, and put it back in mySQL again. Depending on the size of your data, PERL might be better suited.

  3. #3
    SitePoint Member
    Join Date
    May 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Examples

    well, the main problem is, that I do not know how to write a script tthat would do this.
    And I do not feel like doing a replace for every special character in nearly 6000 records..(even though BBEdit is a great prog.)


    May I email it to you?


    (Btw, thx for your help..)


    John
    Last edited by johnd0e; May 4, 2002 at 21:21.

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    May I email it to you?
    No, thanks. As I said, upload it to a server, as a plain text file, preferrably zipped. Just a few samples, not all of the 6000 entries ;-)

    Basically, you either:

    change the content of your tables ONCE with a desktop-app (Edit Plus, HTML-Kit, BBEdit...)

    or

    ditto, but via PERL-/PHP-Script on the server

    or

    do a "replace" function when outputting from your existing db


    By the way: sooner or later you WILL have to learn about regular expressions and replace functions. So why not start now?

    Also check this:
    http://www.php.net/manual/en/function.chr.php
    http://www.mindspring.com/~jc1/seria...ces/ASCII.html
    http://www.google.com/search?hl=en&q...php%20examples


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •