List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:April 13 2005 4:13am
Subject:Re: utf8 questions?
View as plain text  
At 9:59 +0800 4/13/05, D. wrote:
>I don't know if this is the right way to get back to the thread,
>hopefully this will be placed under the same thread. :)
>
>Thank you for your input, Ligaya.
>ahhh...mbstring, I tired that after i got your reply, but it didn't
>help to solve the puzzle,
>
>I did manage to find myself a solution last night though,
>
>it turns out that even if I set --default-character-set = utf-8 in the
>option file,
>the character_set_client, character_set_results,
>character_set_connection somehow are still latin1.

Possibilities:

- option file is not one that is read by mysql
- you didn't put the option in the [mysql] section
- you included the leading dashes.

If you invoke mysql with the --default-character-set=utf8 option on
the command line, are the character_set_xxx variables set properly?

>
>I don't know if this is some bug in mysql (--default-character-set in
>option file has little or no effects??), or it has to do with php
>internal encoding(php issues a latin1 charset upon every mysql
>connection by default?? is that possible? I am still wondering....)
>anyway, i manage to issue a SET NAMES  'utf8'; query after every
>connection, and everything works well.
>
>I'm pretty satisfied with this result at the moment, now i can catch
>some sleeps happily.
>
>thank you again,
>
>de-zhao cai
>
>On 4/13/05, Ligaya Turmelle <lig@stripped> wrote:
>>  have you altered your php.ini file in the mbstring section?  I don't
>>  know if it makes a difference but I have always changed my to:
>>
>>  ; language for internal character representation.
>>  mbstring.language = utf8
>>  ; internal/script encoding.
>>  mbstring.internal_encoding = utf8
>>
>>  and have never had a problem.
>>
>>  D. wrote:
>>
>>  > Hi, this might not be a mysql problem, but hopefully someone will be
>>  > able to answer, thanks in advance.
>>  >
>>  > I notice a lot of people had asked the same question and the typical
>>  > response in the mailing list seemed to be, "make sure you encode the
>>  > data to utf-8 before insert into mysql...", or something similiar.
>>  >
>>  > I have tried that too, but somehow it didn't work out..
>>  >
>>  > what i'm trying to do is, to make everything utf-8, so that there is
>>  > no conversion between database <-> connection <-> php <->
> output (at
>>  > least on the server level)
>>  >
>>  > the first thing i did was to set mysql charset variables:
>>  > character set client  utf8
>>  > character set connection  utf8
>>  > character set database  utf8
>>  > character set results  utf8
>>  > character set server  utf8
>>  > character set system  utf8
>>  >
>>  > all database, tables are created in utf8
>>  >
>>  > output HTML charset: utf-8
>>  > (I even set the php code to utf-8...dont know if that's useful...)
>>  >
>>  > case 1:
>>  > when i input traditional chinese characters on internet explorer
>>  > (charset utf-8) and store them into database, supposingly there's no
>>  > need to go through any encoding conversion? (the browser will send the
>>  > data in utf-8? i did a utf-8 validation, just to make sure all the
>>  > data are utf-8 before i insert, and the data was utf-8 validated.)
>>  >
>>  > when I extract the data from mysql:
>>  > 1. it works fine, almost all characters can display properly, except
>>  > for some characters. (example: åã ʾ, will show
> up as þ[ ?)
>>  > 2. NONE of the data showed up correctly in mysql query browser
>>  >
>>  > case 2:
>>  > i inputed in a set of test data in mysql query browser, and it shows
>>  > up properly in mysql query browser, but when i try to fetch the data
>>  > from my php, and render it to browser(  charset utf-8), it shows up
>>  > ????? (that's the problem other ppl are having i guess, but i have
>>  > done all those encoding steps, did I?)
>>  >
>>  > phpMyAdmin (my version 2.6.1beta, and 2.6.1) behaves the same way
>>  > mysql query browser does.
>>  >
>>  > just to make things less complicated, 
>>instead of getting data from browser,
>>  > i tried to get from uft-8 encoded files (same bad result),
>>  > and i tired to make the data contained in a variable inside the php
>  > > code page(utf-8 encoded), same problem occured.
>>  > and lastly, i tried to output the posted data back to browser(without
>>  > going through database), internet explorer renders all characters
>>  > properly.
>>  >
>>  > so it seems to me that i'm missing something on the php & mysql
>>  > communication level. is that so?
>>  >
>>  > other information:
>>  > php 5.0.3
>>  > apache 2.0.53
>>  > windows xp sp2
>>  > mysql 4.1.10a with innoDB/utf8 default
>>  > mysql query browser 1.1.6
>>  > phpMyAdmin 2.6.1
>>  > mysql & mysqli
>>  >
>>  > I notice that phpMyAdmin doesn't have this problem when it displays
>>  > the data it stores, probably this is not a mysql issue, (phpMyAmin
>>  > works well with MySql Query Browser too, i must have missed something
>>  > in php i guess), hopefully someone will be able to tell me, so my
>>  > questions are:
>>  >
>>  > after setting mysql charset to utf-8, and beside making sure the data
>>  > is encoded in utf-8 properly (which i think i did), what else do i
>>  > need to do on the programming level?
>>  > or could i have done wrong in some of the steps?
>>  > or could i have not done some necessary steps to work with mysql
>>  > charset features?
>>  >
>>  > and lastly,
>>  > is it possible to develope an encoding conversion free program(at
>>  > least on the server(s) level)?
>>  >
>>  > any inputs will be appreciated. I thank everyone in advance.
>>  >
>  > > de-zhao
>>  >
>>
>>  --
>>  Respectfully,
>>  Ligaya Turmelle
>>
>>  "Life is a game.... so have fun"
>>
>>
>>


-- 
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
Thread
utf8 questions?D.12 Apr
  • Re: utf8 questions?Ligaya Turmelle13 Apr
    • Re: utf8 questions?D.13 Apr
      • Re: utf8 questions?Paul DuBois13 Apr
Re: utf8 questions?D.13 Apr