It comes to me (from the frontend) the string of the form Привееееееет . If you write it directly to the database, you get ???????????? . How to translate such a string in an unknown format into a format suitable for mysql ?

  • From the frontend line comes in this form, or just sent? If it does, it is corrected by the filter for the receiving servlet. If it comes normally, then the encoding is set for mysql (1. SET NAMES 'utf8'; 2. SET CHARACTER SET 'utf8'; 3. SET SESSION collation_connection = 'utf8_general_ci') - carapuz
  • @carapuz I send via AngularJS and see what I have received the servlet. A correct message is printed, but question marks are written to the database. - faoxis

1 answer 1

Try:

 String result = Arrays.toString(str.getBytes("UTF-8")); 

str is your incoming string. Try to find out in what encoding send or pick up.