Accent problem ( -jar mysql)

Asked

Viewed 197 times

2

Hello,

I made a program in Java that inserts several texts in a database, running from my machine (Mac Os), everything works very well. But, putting in a VPS (Windows) for the program to run 24/7, the seats in the Bank get bugged, as for example:

"integrante do �lbum "Ladrão"

I am running the program via a . bat that contains only the line:

java -jar "C:\Users\Administrator\Desktop\JavaApplication27.jar"

Connection via jdbc to a Mysql database (from a Cpanel/Hosting) hosted at Hostgator.

 static final String DB_URL = "jdbc:mysql://br934.hostgator.com.br:3306/"+DB+"?useUnicode=true&characterEncoding=utf8";

The database has the charset in utf8mb4.

What is the program?

It hits a Youtube API, bringing the title and description of various videos, and many contain special characters and even emoticons.

--

In summary, I made a program in Netbeans in Java, after compiled, when I run the . jar on Mac Os, it works without any problem, but when I run it. jar in Windows Server 2012 R2 Standard all accents that go pro INSERT INTO, get bugged in the database, as the example above.

How can I resolve the issue with the accent being inserted wrong when the program is running on windows?

  • 1

    Please provide more information through edit and read about How To Ask and also a tour

  • @Amadeuantunes what kind of more information is needed?

  • What database is used and how do you connect to it?

  • Mysql, hosted on Hostgator, connected by jdbc

1 answer

1

Dude, I don’t know if it helps you, but take a look at your bank and see his "charset" (whether it’s UTF-8 or some other);

Also try to use HTML within Java code (a nice hack, but it works).

Example:

System.out.println("<html><meta charset="utf-8"/>Este é meu exemplo. Aqui todos os acentos funcionam hehehehehe</html>");

Exit:

This is my example. Here all the accents work hehehehehehe

  • I’m working with the charset in utf8mb4 at the bank. This way would not work, I take titles and descriptions and add in the database, to display on a website (PHP)

  • I guess then I can’t help yet. I’ve just started studying databases and SQL :/

  • Mysql does not support utf8mb4 it uses ISO 8859-1 instead, which generates the anomalies.

Browser other questions tagged

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