SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with Spanish Characters

    Hello

    I have a problem. I am using UTF-8 on my PHP webstie, and the Mysql has latin charset.

    Now if any user enter any special latin charanter like etc, it replaces the character to some other character and then the value in the mysql is not what the user entered.

    What I can confirm is that it is something with PHP etc, as If i can make DIRECT INSERT ON MYSQL (via PHPMYADMIN) it can store the special characters properly, but whenever the insertion is done via HTML form and PHP, it make the entry corrupt.

    Please guide.

    Thanks
    Zeeshan

  2. #2
    SitePoint Guru
    Join Date
    Jan 2005
    Location
    heaven
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post some code?
    Creativity knows no other restraint than the
    confines of a small mind.
    - Me
    Geekly Humor
    Oh baby! Check out the design patterns on that framework!

  3. #3
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hummm its simple, like HTML form to take user input, and then posting them to php script that will insert the data in to the database.

  4. #4
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i repeat the code is simple

    just a html form. and that post to a php script and when I print / email / store to database that collected data, it replaces the spanish characters like with some garbage characters.

    please help

  5. #5
    SitePoint Zealot
    Join Date
    May 2002
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought I replied but I must have forgotten to press the submit button.

    I suspect that your problem lies with your collation settings with mysql. Under each field, you can choose the encoding for the field. You may want to select utf_spanish_ci for your particular field, or the entire table. Try if it helps.
    UploadPro.org - Version 2 launched.

  6. #6
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello

    I tried almost every thing. But failed. I can receive the correct email when the user fills in a form. But that information is also stored in a database. And that is not accurate. I mean the spanish accent are not properly stored in the database.

    please guide me what might be the issue. My pages charset is utf-8 and on the MySQL i tried utf8_unicode_ci, general, latin etc etc but nothing worked for me.

    One thing to mention is that, when I enter the accent character directly in MySQL through PHPMyADMIN it stores perfectly. But when I use the insert query in the script to insert the collected data in the database it replaces the special characters with garbage. However, the same script also send an email, and the data in the email as 100% correct.

    Please guide me I m an trouble due to this problem.

  7. #7
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Could be your webpage has not told your browser which encoding to use, so its doing its best to guess.

    David Baron’s Why Web authors must specify character encodings explains this well

    Test this by changing the char encoding in your browsers menu now,
    in FF3
    =====
    Menu
    -View
    --Character encoding
    ---Pick another, spanish?

  8. #8
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks


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
  •