티스토리 뷰

공부

[Python] MySQL charset='utf8'

승가비 2020. 10. 3. 20:01
728x90
MySQLdb.connect(..., use_unicode=1,charset="utf8")

https://stackoverflow.com/questions/9331010/mysql-in-python-encoding

 

mysql in python encoding

This post is the same with my question in MySQL in Python: UnicodeEncodeError: 'ascii' this is just to clear things up. I am trying to save a string to a MySQL database but I get an error:...

stackoverflow.com

p.agent_info = u' '.join((agent_contact, agent_telno)).encode('utf-8').strip()

https://stackoverflow.com/questions/9942594/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-20

 

UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)

I'm having problems dealing with unicode characters from text fetched from different web pages (on different sites). I am using BeautifulSoup. The problem is that the error is not always reproduc...

stackoverflow.com

 

728x90
댓글