0

Framework

AngularJs

Database

MySQL

Backend

Jboss

Error

My app has a <textarea></textarea> for comments from user. AngularJs gets the comment and saves it to MySQL DB. The problem that I am facing is whenever I try to send any emoticons in the text-area, It gets converted to special characters and square boxes with numbers in it.

These are the list of things I tried and failed,

  1. Checked my database conf file and made sure that the charset is

utf8mb4

on both client and server side

  1. I have changed the Header of post request to ContentType:application/json

Since I have just been introduced to JBoss, Java and MySQL, please let me know If I missed something.

I cannot post the code because it's really large and I am not looking for the exact answer, just some area where I could look into.

I don't think the problem is in Angular part because it is sending the emoticons correctly (please correct me if I am wrong) as can be seen on the console.This is a screenshot of my console when I hit submit button

UPDATE

Details of my MySQL table:

enter image description here

Screen of one of the comments in db.

enter image description here

Thanks for the help.

Abhinav Alok
  • 120
  • 1
  • 1
  • 16
  • make sure the table has utf8mb4 as the column that records the data, or the default for the table. (`SHOW CREATE TABLE {tbsname}`) – danblack Sep 18 '18 at 09:20
  • @danblack Yes, my table has utf8mb4. – Abhinav Alok Sep 18 '18 at 09:24
  • @danblack Please, check my question. I have added a screenshot of my console when I hit the submit button. – Abhinav Alok Sep 18 '18 at 09:50
  • Showing `SHOW CREATE TABLE {tblname}` and a `SELECT comment FROM {tblname}` would be useful. After that look what happens in the JBoss/ Java layers. – danblack Sep 18 '18 at 23:25
  • @danblack Thanks for the reply. I went through my Db, everything seems to have proper settings. I am completely clueless as to why this is happening, any suggestion would be of great help now. – Abhinav Alok Sep 19 '18 at 05:49
  • `SHOW TABLE STATUS` != `SHOW CREATE TABLE`. Asking 3 times it a bit much. Hide the other columns if you don't want to show them. `SELECT HEX(comment),comment FROM table WHERE ..` might be a good comparison point. SO supports text too, don't have to put things as images. – danblack Sep 19 '18 at 06:13
  • Some Emoji need `CHARACTER SET utf8mb4`, not `utf8`. – Rick James Oct 06 '18 at 05:13

0 Answers0