Git Product home page Git Product logo

Comments (7)

nakagami avatar nakagami commented on July 22, 2024

Please show me sample code and that Traceback or any error messages.

from cymysql.

roniemartinez avatar roniemartinez commented on July 22, 2024

Here is the error code, unfortunately, I cannot show everything:
image

That is just a normal error code when inserting an emoji into a table. However, the database and the tables are already set up in utf8mb4 (charset) and utf8mb4_unicode_ci (collation).

This is the CyMySQL code that does not work:

connection = cymysql.connect(host=host, port=port, user=user, passwd=password, db=db)

However, it's equivalent PyMySQL code works by just changing the module

connection = pymysql.connect(host=host, port=port, user=user, passwd=password, db=db)

By explicitly specifying charset, CyMySQL works.

connection = cymysql.connect(host=host, port=port, user=user, passwd=password, db=db, charset='utf8mb4')

This is not the intended behavior of CyMySQL (based on source) for Python 3 as it should default to using unicode.

from cymysql.

nakagami avatar nakagami commented on July 22, 2024

Thanks, I understand.

Can you test with master HEAD branch on Github ?

from cymysql.

roniemartinez avatar roniemartinez commented on July 22, 2024

INSERT query works, however, it fails when SELECT is used to cross-check

E       AssertionError: assert '\U0001f40d' == '\xf0\\x9f\\x90\\x8d'
E         - \U0001f40d
E         ? ^
E         + \xf0\x9f\x90\x8d
E         ? ^^^^

Here are the original and SELECTed data

🐍
�

Explicitly specifying charset='utf8mb4' will output the correct emoji. I believe, the decoding side was not set.

from cymysql.

nakagami avatar nakagami commented on July 22, 2024

thanks
I will support utf8mb4 charset.

from cymysql.

nakagami avatar nakagami commented on July 22, 2024

version 0.9.14 released
Please check it

from cymysql.

roniemartinez avatar roniemartinez commented on July 22, 2024

@nakagami Verified! Thank you!

from cymysql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.