Mysql Decoding - Javascript

0

Good afternoon, I have a procedure in MYSQL that returns processing information.

 ELSE
    IF(linhas_banco_in_p <> 0) THEN
        SET msg = 'ESSA CONTA E AGÊNCIA JÁ EXISTE NESSE BANCO, VERIFIQUE AS INFORMAÇÕES E TENTE NOVAMENTE';
        SELECT msg;
        ROLLBACK;
    ELSE

        INSERT INTO banco (
                nome_banco,

This message returns and is displayed via Javascript on the registration screen, within a modal. The problem is that the characters are coming this way:

<metacharset="utf-8" />

I tried using the charset = 'utf-8' function inside the JavaScript tag, without success. How do I fix it?

Thank you

    
asked by anonymous 07.01.2018 / 20:01

1 answer

2

Basically it is a matter of saving your procedure in the right encoding, see in the options of your code editor (or DB utility) how to save as UTF-8 (or the encoding that will be used in your page and mainly compatible with the table of the DB).

An alternative (less noble in this case, it is not a global solution) is to use entities (but check compatibility with the HTML standard used):

SET msg = 'ESSA CONTA E AG&Ecirc;NCIA J&Aacute; EXISTEM NESSE BANCO,
           VERIFIQUE AS INFORMA&Ccedil;&Otilde;ES E TENTE NOVAMENTE'


If you have any other problems on the PHP and MySQL side, the solution is probably here:

  

Doubt with charset = iso-8859-1 and utf8


And if you're using any specific code editor ...

As Sublime Text, for example, the solution is here:

  

Sublime Text 2 - Encoding UTF-8 does not work

For NetBeans:

  

Netbeans messing accent

For other editors it's always the same logic. When saving, choose the correct encoding.

    
07.01.2018 / 20:27