Hi barophobia,

I had the same problems as you. I am using special spanish characters
as '�', '�' and so on.

What I did to solve the problems was:

1. In MySQL database, establish the collation as 'utf8_spanish2_ci'.
To japanese characters you can use 'utf8_unicode_ci'.

2. When you load an html page using .load jquery function. For
example:

$('#op_co_wrap').load('html/encuesta/editar_encuesta.html',
function()
....

You have to ensure that the format of 'html/encuesta/
editar_encuesta.html' file is utf-8. To do this, I am using notepad++
free program: http://notepad-plus.sourceforge.net/es/site.htm.   What
you have to do is to open the html file with notepadd++ and go to
Format-->Codify in UTF-8.


3. I am using PHP as web server language. I think you too. Well, if
you want to insert, update, .... registers with japanese utf-8
characters what you should do in your php script is something like:

        $instDB = new cDB();
        $con = $instDB->connect();
        $instDB->executequery("SET NAMES 'utf8'", $con);  //IMPORTANT!!!!!!
        $instDB->executequery("INSERT INTO respuestas (id_encuesta,
respuesta, veces_elegida)
                                                                        VALUES 
('".$_POST['id_encuesta']."', '".
$_POST['a_nom_respuestas'][$i]."', '0')", $con);
        .......

executequery code is:
   function executequery ($consult, $id)
   {
      return  mysql_query($consult,$id);
   }


I think there is anything left.

I hope it will help you.

David.

On 20 ago, 19:11, barophobia <[EMAIL PROTECTED]> wrote:
> On 8/20/07, Bil Corry <[EMAIL PROTECTED]> wrote:
>
>
>
> > barophobia wrote on 8/20/2007 11:58 AM:
> > > 1. Why do you think the standard pages work fine?
>
> > Do you have a meta tag defining the charset?  Most likely that wouldn't be 
> > present in an AJAX call but would tell the browser the correct charset.
>
> You're right about that. I have:
>
> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
>
> > > 2. What about the issue I'm having sending the data? How do I get the
> > > UTF-8 text to be recorded properly when submitted via an AJAX call?
>
> > I believe jQuery sends the data as UTF-8; the issue as I understand it is 
> > when you want to send something other than UTF-8, as per this thread:
>
> >   <http://groups.google.com/group/jquery-en/browse_thread/thread/5fc0bd4...>
>
> > You said you're using Japanese characters, are you sure you're using UTF-8 
> > or could you be using SHIFT_JIS?  Do you have an example page?
>
> Actually I'm using UTF-8 for that exact reason. This application will
> be (at some point) translated into as many languages as I can get.
>
> Based on your information I think my problems will be solved once I
> get the server to serve PHP as UTF-8 (I think I can do this via
> .htaccess).
>
> Thanks for your help with this!
> Ch ris.

Reply via email to