Problem with accentuated character in the return of the query

Asked

Viewed 98 times

0

I have a Mysql database with encoding defined as latin1_swedish_ci.

I’m using Dapper to connect the database. When I make a query to certain tables, the characters that are accented comes as follows , but the characters that do not accentuate get normal.

For example should come abraão, but it’s coming abra�o.

Observation: I’ve already set up the connectionstring to receive UTF-8 (CharSet=utf8;).

Web.config:

<system.web>
  <globalization
     fileEncoding="iso-8859-1"
     requestEncoding="iso-8859-1"
     responseEncoding="iso-8859-1"
     culture="pt-BR"
     uiCulture="pt-BR"
  />
</system.web>
  • 1

    And as it is the direct consultation in the bank?

  • When I use select straight from heidiSql the return is coming right, ie, abraão.

  • I don’t quite understand, but you talk about leaving the connectionstrings that way ? Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword; Charset=latin1_swedish_ci;

1 answer

1


To solve this question I had to make changes in the bank. Observation: The change in encoding in the database, table and columns. As can be seen in the code below


ALTER DATABASE `banco` CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE `banco`.`tabela` CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE `banco`.`tabela` MODIFY `Coluna` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Browser other questions tagged

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