Error coding html text in MySQL

3

I'm having trouble sending accented texts to the database as words with Ç Ã etc.

Let's say I send text like this This is a post action for you

What happens and only sends ata That and a the rest of the text is not being sent this giving error of coding the texts. How can I fix this?

CREATE TABLE IF NOT EXISTS 'news' (
  'id' int(255) NOT NULL AUTO_INCREMENT,
  'titulo_url' varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  'titulo' varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  'noticia' text COLLATE utf8_unicode_ci NOT NULL,
  'data' date NOT NULL,
  'hora' time NOT NULL,,
  'avatar' varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  'autor' char(20) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY ('id'),
  UNIQUE KEY 'tituloUnico' ('titulo'),
  UNIQUE KEY 'urlUnica' ('titulo_url'),
  KEY 'colunasIndexadas' ('id','titulo_url','autor')
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

I do not know why you're giving this error in the submission form.

    
asked by anonymous 07.08.2015 / 07:32

1 answer

2

Your problem is in collate and Charset .

If the charset is Latin1 , use collate latin1_swedish_ci

If the charset is UTF8 , use collate utf8_general_ci

You can change using the commands:

ALTER DATABASE 'sua_base' CHARSET = Latin1 COLLATE = latin1_swedish_ci;

or

ALTER DATABASE 'sua_base' CHARSET = UTF8 COLLATE = utf8_general_ci;

Thus, the accent will be sent and interpreted correctly by your database.

    
07.08.2015 / 13:56