0

enter image description here

Whenever I try to save an address with non-ascii characters like:

721-1 Higashishiokōjichō, Shimogyō-ku, Kyoto, 600-8216, Japan

Mysql fails with an error:

OperationalError(1366, "Incorrect string value: '\\xC5\\x8Djich...' for column 'formatted_address' at row 1")

What is the best practice to save foreign language characters in database? Should I just ignore these characters in code? Or find a way to store them in MySQL (how?) ?

EDIT:

Ok after reading few articles, I tried changing the formatting of my database column from latin1 to utf8. But the query just hangs and times out. Can anyone help?

ALTER TABLE <MYTABLE> MODIFY formatted_address TEXT CHARACTER SET utf8 COLLATE utf8_general_ci;

SOLVED: this worked :) -> https://stackoverflow.com/a/6115705/3520404

saran3h
  • 12,353
  • 4
  • 42
  • 54
  • It's a different issue. In that post, the person is able to save non-ascii in database but having problems when retrieving it. However, I can't save them in DB in the first place, – saran3h Sep 02 '19 at 07:59
  • @LinPy im using python. Found the solution thanks anyway. – saran3h Sep 02 '19 at 10:11

0 Answers0