Hi!
I'm using php 5.2.13.. that's newer than 5.2.4 .. should be ok.
i'v added a raw sql insert in the script like :
if ($import[0]=='9789060059166') {
// echo $import[84];
// echo '<br>'.$boek->getBeschrijving();
mysql_connect("10.10.0.106", "user", "password") or
die(mysql_error());
mysql_select_db("bookio") or die(mysql_error());
mysql_query("UPDATE Boeken SET beschrijving = '".$import[84]."' where
id = ".$boek->getId())
or die(mysql_error());
echo $query;
echo "Data Inserted!";
exit();
}
and the string is correctly in the database without truncation ...
when i run file in linux i get:
Non-ISO extended-ASCII English text, with very long lines, with CRLF,
NEL line terminators
when i do: mb_detect_encoding($import[84]) i get: UTF-8
when i do: mb_check_encoding($import[84],"UT-8") i get: False
so i changed the script to:
$boek = new Boek();
$boek->setDecription(utf8_encode($import[85]));
$boek->save()
Now it's working fine! I think symfony or doctrine is somehow more
strict then a raw php / mysql insert ...
Thanks for al your help! The case can be closed.
Roland
On 29 apr, 17:21, Rodrigo Ruiz Fuentes <[email protected]> wrote:
> El 28/04/10 17:35, Roland Cremer escribió:
>
> > Someone an idea? I'm still searching for the problem..
>
> Hi Roland,
> Your files CSV are saved/generated with UTF-8 charset? (use 'file'
> command on linux to get that info), if not or if you can't control that
> thing, so you can use utf8_encode/utf8_decode before save data on action.
>
> Cheers!
>
>
>
>
>
> > ---------- Forwarded message ----------
> > From: *Roland Cremer* <[email protected]
> > <mailto:[email protected]>>
> > Date: 2010/4/25
> > Subject: Doctrine: strange charset problem on saving data to MySQL database
> > To: [email protected] <mailto:[email protected]>
>
> > Hi all,
> > I've got a strange problem on saving data to the database.
> > i have a made a symfony-task to import a csv file and save the objects
> > to the database. This works fine.. but whenever a utf8 character comes
> > in, the data is truncated and only the data before the character is
> > saved to the database.
> > For example:
> > "Totdat hij besluit het roer om te gooien: met diëten en
> > lichaamsbeweging" becomes "Totdat hij besluit het roer om te gooien:
> > met di"
> > The import continues without any error message.
> > When echo the value in the import script i get the full text.. so the
> > problem is somewhere when doctrine saves it to the database.
> > $boek = new Boek();
> > $boek->setDecription($import[85]);
> > $boek->save()
> > echo $import[85];
> > echo $boek->getDescription;
> > Both display the full text: "Totdat hij besluit het roer om te gooien:
> > met diëten en lichaamsbeweging"
> > When i put the text with a manual insert in the database, it saves the
> > record without a problem. and the $boek->getDescription on the frontend
> > site shows the full text.
> > The database is configured with Charset utf-8 and collation utf8_unicode_ci
> > In my schema.yml i start with: (also tried it without this)
> > options:
> > collate: utf8_unicode_ci
> > charset: utf8
> > In the ProjectConfiguration.class.php i've added: (also tried it without
> > this)
> > public function configureDoctrine(Doctrine_Manager $manager)
> > {
> > $manager->setCollate('utf8_unicode_ci');
> > $manager->setCharset('utf8');
> > }
> > and in the settings.yml i've added: (also tried it without this)
> > all:
> > charset: utf-8
> > I'm using:
> > php: 5.2.13
> > mysql: 5.1.39
> > symfony 1.4.4 - doctrine
> > Is this a bug or have i made a mistake?
> > thanx in advance for helping me out
> > Roland
>
> --
> Rodrigo Ruiz Fuentes
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group
> athttp://groups.google.com/group/symfony-users?hl=en- Tekst uit
> oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en