2

Database I have on heroku doesn't support special characters so I want to set utf8 encoding. When I was working on local version I simply changed config files but I wonder how I can achieve this using Heroku's DB.

This added to connection url doesn't help:

?useUnicode=true&characterEncoding=UTF-8
askstackoverflow
  • 301
  • 3
  • 11
  • Where symptoms do you see? What charset is declared in the tables? – Rick James Dec 09 '19 at 17:17
  • @RickJames, I have already got tables to use utf8mb4 but for some reason when I save data through api it saves special characters as '?'. When I run simple 'insert' query with special characters it saves them normally so it probably is not db's config fault as I initially suspected – askstackoverflow Dec 11 '19 at 11:14
  • 1
    See "question mark" in https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored You have done a couple of the things to handle UTF-8, but there are a couple more. – Rick James Dec 11 '19 at 16:32

2 Answers2

6

I resolved this problem when I set this ?useUnicode=true&characterEncoding=UTF-8 into "Config Vars" on site heroku.com in section "settings" after question mark. Look up at image description here http://images.vfl.ru/ii/1588540106/e4c9cfa2/30400062.jpg

Eugene Zakhno
  • 61
  • 1
  • 7
  • I'm having a problem with emoji thing, now I think after doing this suggestion of yours, somehow everything's working pretty fine. I haven't checked it thoroughly though – Glenn Posadas Jun 01 '20 at 09:14
0

Switch from the ClearDB heroku add-on JawsDB MySQL solve my problem.

Adriano Campos
  • 1,121
  • 7
  • 14