Accentuation of the database not accepted on the site

Asked

Viewed 59 times

0

I have a text in the database but the site does not assume the accentuation of type ã, á, ç and puts in place of those letters some strange characters: inserir a descrição da imagem aqui

My database is with latin1_swedish_ci grouping and the site reads the accents I put directly.

How do I make the site accept database accentuation?

  • 1

    Dude, what Latin for? Has anyone ever told you about UTF-8? Try switching to utf-8!

  • already switched to utf-8 and can’t still not accept accentuation (meti utf-8 bin has not only utf-8)

  • So, you’ll see it’s some host problem, that I know utf-8 and universal type

  • 2

    Grouping has nothing to do with display, it is only used for comparison and sorting. Important to see the table encoding if it is even latin. If you are, it’s a matter of setting up the rest of the application in the same way (page server headers, any meta tags) and setting up your code editor to save to the same encoding. Virtually all (many) site doubts about the subject are related to the fact that people mix encodings in the same application.

2 answers

0

You are using different Charsets on the page and in the bank, so the problem; in the head I can think of some solutions:

  • Switch bank to UTF-8. The best solution of all but may not be feasible
  • Switch the page(s) (s) to the same bank charset using the corresponding tags. Not quite the best but depending on the amount of pages may be the easiest to implement.
  • Do the charset conversion on the server after reading from the database and before sending the result. I smell "POG" but can be a solution. It can be done using language-specific functions that are doing the query or via database; mysql, for example, has "cast" and "Convert" functions that allow to convert the data between Charsets.

0

There are a number of factors that can influence this problem:

first - Check the encoding of the text being saved by your text editor;
2nd - Check the encoding that is being used in your browser (test it in multiple browsers to make sure the problem is really in the bank);
- Check the bank’s encryption;
fourth - Check the encoding of the tables;
5th - Check the encoding of table cells that accept characters;

In extreme case use functions, be it javascript, php or the language of your preference to force the input and output of the database in the correct encoding.

I advise using the encoding UTF-8, which is currently the most used by browsers.

  • 1

    This last phrase, "currently the most used by browsers", does not make much sense. Who defines the encoding is the page, not the browser. It only follows what is instructed by the server or page.

  • Yes, but the default is UTF-8, so it is, or should be, the most commonly used encoding.

Browser other questions tagged

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