Results 1 to 4 of 4

Thread: French accent in mysql database

  1. #1
    Join Date
    Aug 2007
    Posts
    16
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default French accent in mysql database

    Hi,
    I have a form submission into mysql table. The french accents are converted into something like this.
    "Précédente" to "Précédente" in the database.

    I set the page charset to iso-8859-1 and db field collation to 'utf8_unicode_ci' and type as 'varchar'.

    Any way to get the accents as it is entered into the form to the database?
    To be more precise, after the INSERT the database will contain data with the french accents. Is that possible?

    Thanks in advance for your help.
    Last edited by gulluman1; 12-15-2009 at 02:02 AM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Make all encodings match: HTML, mysql and also the encoding of the .htm file itself. Unless you are specifically changing it like with htmlentities() then this is the problem. Iso is bad for foreign characters and Unicode is designed for that exact purpose.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Aug 2007
    Posts
    16
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi, thanks for your reply.
    I am doing it in php and the html part looks like this.
    I have multipage forms that i built in php. It was initially UTF but the accents were getting messed up in the form fields once the person goes to review thier inputs. This is how my headings looks like.
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta http-equiv="content-type" 
    		content="text/html;charset=iso-8859-1" />
    	<meta http-equiv="Content-Style-Type" content="text/css" />
    If i put utf-8...everything comes into weird language..all the accents are removed. iso-8859-1 seems to work perfect for forms. but the accents do not get written as it is in the database. i tried. utf-general and utf-bin..

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    UTF-general should work for this. If it is not working, then it may be an issue tied to the system as a whole. Different encodings do not necessarily work well together, so you need to start with all new data. If you setup everything in utf, then insert new data and do whatever you need to with it, does it work then? If not, then there may be another issue with utf and, for example, submitting forms, but you need to not work with the old data.

    Once you get a working system, you can of course find a way to import the old data back into it (if you need to save that), perhaps by cutting/pasting through a text editor if nothing else.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •