2009年12月23日星期三

Re: [fw-mvc] Problem: Turkish Characters can not be saved to database

Hello Padraic,

Thanks for the info. I will give it a try and let you know. For now I leave the code as it is. As soon as I start clear up the application, I will take a look. I put it in my task list.

By the way, when are you going to publish survivingthedeep in pdf? I can not wait to translate it in Turkish:)

Regards and merry christmas.
E

2009/12/23 Pádraic Brady <padraic.brady@yahoo.com>
That function should have read mb_strtolower() ;)
 
Pádraic Brady

http://blog.astrumfutura.com
http://www.survivethedeepend.com
OpenID Europe Foundation Irish Representative



From: Pádraic Brady <padraic.brady@yahoo.com>
To: "erdal.yazicioglu@gmail.com" <erdal.yazicioglu@gmail.com>
Cc: "fw-mvc@lists.zend.com" <fw-mvc@lists.zend.com>
Sent: Wed, December 23, 2009 7:41:12 AM
Subject: Re: [fw-mvc] Problem: Turkish Characters can not be saved to database

Try using a unicode safe method for lowercasing like iconv_strtolower. The base function is only useful for US ASCII.

Paddy

Sent from my iPhone

On 22 Dec 2009, at 12:43, Erdal YAZICIOGLU <erdal.yazicioglu@gmail.com> wrote:

Hello all

I have a really very strange problem withthe Turkish characters.

I have a form where alumni registers itself. I am trying to convert all
data to lowercase and then write to database.

In the model I create a function

public function toLowerCase($input)
  {   
  return strtolower(strtr($input,'ĞÜŞIİÖÇ','ğüşıiöç'));
  }

After a successful admission I write the data to database in model as
follows.

function registerAlumni($alumniName,$alumniLastName,$alumniGraduateDate)
  {
      $data = array('alumni_Name'=>$this->toLowerCase($alumniName),
                  'alumni_LastName'=>$this->toLowerCase($alumniLastName),
                  'alumni_GraduateDate'=>$alumniGraduateDate);
      $this->insert($data);
  }

Up to here everything seems to be OK. But when I run the database query,
the characters that are entered in turkish are not written into
database.

I really do not know, if it is Zend or Mysql itself. I use UTF-8 as
character encoding and if I do not use toLowerCase method, it writes to
database without problem.

Any ideas are more than welcome.

E

mysql> select alumni_Name,alumni_LastName,alumni_GraduateDate from
gbhl_alumni order by alumni_ID desc
  -> ;
+---------------------+-----------------+---------------------+
| alumni_Name        | alumni_LastName | alumni_GraduateDate |
+---------------------+-----------------+---------------------+
|                    | mmmmmmmmmmm    |                1991 |
|                    | mmmmmmmmmmm    |                1991 |
|                    | mmmmmmmmmmm    |                1991 |
|                    | mmmmmmmmmmm    |                1991 |
|                    | mmmmmmmmmmm    |                1991 |
|                    | mmmmmmmmmmm    |                1991 |
|                    | mmmmmmmmmmm    |                1991 |
| mmmmmmmmmmmmmmmm    | mmmmmmmmmmm    |                1991 |
|                    |                |                1991 |
|                    |                |                1991 |








--

Erdal YAZICIOGLU
Field Project Engineer Manager
Page Europa S.R.L - General Dynamics
www.pageuropa.it
Office - Rome : +39 0650395292
Mobile -Rome : +39 3490787196
Mobile -Istanbul: +90 536 3447989

没有评论: