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 |
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 |
没有评论:
发表评论