GithubHelp home page GithubHelp logo

Comments (8)

cleiter avatar cleiter commented on July 30, 2024 1

Everything is UTF-8. Pretty sure the problem is in PHP. I probably have to go with the iconv solution to fix this once and for all... Also see docker-library/php#240

from docker-osticket.

cleiter avatar cleiter commented on July 30, 2024

I used your second solution (mbstring) which worked fine until now. But I just got a mail with an utf-8 smiley and it truncated the message again.

from docker-osticket.

Jamesits avatar Jamesits commented on July 30, 2024

@cleiter I haven't tried emojis. What's your database charset?

from docker-osticket.

cleiter avatar cleiter commented on July 30, 2024

So i tried that (built my own docker image) and actually it did not improve things. I investigated further and saw that the correct type in mysql is not utf8 but utf8mb4.

I did a quick:

set sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
alter table ost_thread_entry convert to character set utf8mb4 collate utf8mb4_unicode_ci;

(the first thing removes NO_ZERO_IN_DATE,NO_ZERO_DATE otherwise it won't let me update the table)

and now I get ???? instead of an emoji but the text is not truncated anymore.

Still not a perfect solution but hopefully it helps someone.

from docker-osticket.

Jamesits avatar Jamesits commented on July 30, 2024

@cleiter utf8mb4 only affects 4-byte chars. Some emojis are 4-byte but most of them are 3-byte so they should be fine with utf8. However to use utf8mb4 you need to:

  1. change default encoding in MySQL
  2. set default encoding in PHP when establishing database session

Otherwise, it won't work.

from docker-osticket.

cleiter avatar cleiter commented on July 30, 2024

I did change the default encoding to utf8mb4 but that doesn't affect existing tables, hence the alter table query.

How would I set the mysql encoding in PHP for osticket?

from docker-osticket.

Jamesits avatar Jamesits commented on July 30, 2024

@cleiter see https://stackoverflow.com/questions/16893035/using-utf8mb4-with-php-and-mysql

from docker-osticket.

cleiter avatar cleiter commented on July 30, 2024

OK thanks for your help :) I'll live with it as it is.

For reference, this was indeed a 4 byte smiley: 😊 (f09f 988a)

I would be super happy if the base image took care of all these encoding issues.

from docker-osticket.

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.