Mysql html text encoding error

Asked

Viewed 178 times

3

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

Say I send a text like this This is a posting action for you

What happens that only sends minutes That and an a the rest of the text is not being sent this giving error encoding 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 don’t know why I’m giving this error in the shipping form.

  • What charset are you using in BD communication?

  • Trying to save HTML text as <p>Isso e uma ação de postagem para você</p> in the comic book?

  • What language are you using?

  • utf8 I think the problem should be in the case and that I didn’t configure the format of the file in UTF8 should convert it to utf8 without good ?

  • I don’t know, it depends. Are you reading a file and putting it in the comic book? Or is it a web form?

  • 1

    Try using utf8_general_ci encoding in the database

Show 1 more comment

1 answer

2


Your problem is in the collate and Charset.

If the charset is Latin1, wear your leotard latin1_swedish_ci

If the charset is UTF8, wear your leotard 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.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.