CodeIgniter Forums
Problems with some chars on a DB insert - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problems with some chars on a DB insert (/showthread.php?tid=6808)



Problems with some chars on a DB insert - El Forum - 03-12-2008

[eluser]Isern Palaus[/eluser]
Hello,

I'm getting this error:

Quote:An Error Was Encountered

Error Number: 1406

Data too long for column 'body' at row 1

INSERT INTO `posts` (`title`, `url_title`, `body`, `created_on`) VALUES ('El hombre de hielo', 'el-hombre-de-hielo', '

Este hombre que corre desnudo por la nieve se llama Wim Hof. La temperatura exterior es de 15 grados bajo cero. Lleva corriendo más de una hora a escasos kilómetros del Polo Norte y, aunque sus pies descalzos se apoyan directamente sobre el hielo, no muestra ningún síntoma de hipotermia. A Wim Hof le han hecho todo tipo de pruebas para estudiar su capacidad para resistir el frío. En las mismas circunstancias, cualquier ser humano moriría al instante o sufriría graves lesiones.', 1205361156)

If I delete the accents on the letters like í to i works fine. How can I fix them?

Thanks in advance,
-- Isern Palaus


Problems with some chars on a DB insert - El Forum - 03-12-2008

[eluser]mironcho[/eluser]
Hi Isern,
Given error message says "Data too long for column ‘body’ at row 1" - what type, size and collation is this field 'body'?


Problems with some chars on a DB insert - El Forum - 03-12-2008

[eluser]mikeyhell[/eluser]
This is a known bug(we'll not really bug w/ mysql) but issue with sql code written on an xp machine or some flavors of linux. I had the same problem a while back and found that for some reason my sql had to be encoded using latin1 instead of utf8. What are you using to edit the code?


Problems with some chars on a DB insert - El Forum - 03-12-2008

[eluser]mikeyhell[/eluser]
btw mironcho, your avatar pic looks very similar to an area I frequently mtb at. Wasn't taken at palo duro canyon was it?


Problems with some chars on a DB insert - El Forum - 03-12-2008

[eluser]mironcho[/eluser]
[quote author="mikeyhell" date="1205389666"]btw mironcho, your avatar pic looks very similar to an area I frequently mtb at. Wasn't taken at palo duro canyon was it?[/quote]

No - it was taken in one park in Sofia, Bulgaria Smile


Problems with some chars on a DB insert - El Forum - 04-08-2008

[eluser]Isern Palaus[/eluser]
Hey,

Sorry for not responding.

I'm using this table:
Code:
CREATE TABLE `posts` (
`id` int(5) NOT NULL auto_increment,
`title` varchar(64) NOT NULL,
`url_title` varchar(64) NOT NULL,
`body` text NOT NULL,
`created_on` varchar(10) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

In latin1. :S

Thank you in advance,
-- Isern Palaus