Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use emoji as devMode title prefix #71

Closed
Wiejeben opened this issue Apr 15, 2018 · 3 comments
Closed

Unable to use emoji as devMode title prefix #71

Wiejeben opened this issue Apr 15, 2018 · 3 comments

Comments

@Wiejeben
Copy link
Contributor

Wiejeben commented Apr 15, 2018

Configuration:

  • Craft: 3.0.2
  • SEOmatic: 3.0.0-beta.22
  • PHP: 7.0.27
  • MySQL: 5.7.21

I thought it would be really neat if I could use a construction emoji (🚧) instead of the default [devMode] title prefix, however during saving this change I get the following database exception:

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x9A\xA7",...' for column 'settings' at row 1 in /srv/app/vendor/yiisoft/yii2/db/Command.php:1258
Stack trace:
#0 /srv/app/vendor/yiisoft/yii2/db/Command.php(1258): PDOStatement->execute()
#1 /srv/app/vendor/yiisoft/yii2/db/Command.php(1075): yii\db\Command->internalExecute('UPDATE `plugins...')
#2 /srv/app/vendor/craftcms/cms/src/services/Plugins.php(597): yii\db\Command->execute()
#3 /srv/app/vendor/craftcms/cms/src/controllers/PluginsController.php(147): craft\services\Plugins->savePluginSettings(Object(nystudio107\seomatic\Seomatic), Array)
#4 [internal function]: craft\controllers\PluginsController->actionSavePluginSettings()
#5 /srv/app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#6 /srv/app/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#7 /srv/app/vendor/craftcms/cms/src/web/Controller.php(74): yii\base\Controller->runAction('save-plugin-set...', Array)
#8 /srv/app/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-plugin-set...', Array)
#9 /srv/app/vendor/craftcms/cms/src/web/Application.php(244): yii\base\Module->runAction('plugins/save-pl...', Array)
#10 /srv/app/vendor/craftcms/cms/src/web/Application.php(452): craft\web\Application->runAction('plugins/save-pl...', Array)
#11 /srv/app/vendor/craftcms/cms/src/web/Application.php(228): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#12 /srv/app/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#13 /srv/app/web/index.php(21): yii\base\Application->run()
#14 {main}

Next yii\db\Exception: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x9A\xA7",...' for column 'settings' at row 1
The SQL being executed was: UPDATE `plugins` SET `settings`='{\"pluginName\":\"SEO\",\"renderEnabled\":\"1\",\"sitemapsEnabled\":\"1\",\"environment\":\"local\",\"displayPreviewSidebar\":\"1\",\"displayAnalysisSidebar\":true,\"devModeTitlePrefix\":\"🚧\",\"separatorChar\":\"|\",\"maxTitleLength\":\"120\",\"maxDescriptionLength\":\"300\"}', `dateUpdated`='2018-04-15 15:08:00' WHERE `handle`='seomatic' in /srv/app/vendor/yiisoft/yii2/db/Schema.php:664
Stack trace:
#0 /srv/app/vendor/yiisoft/yii2/db/Command.php(1263): yii\db\Schema->convertException(Object(PDOException), 'UPDATE `plugins...')
#1 /srv/app/vendor/yiisoft/yii2/db/Command.php(1075): yii\db\Command->internalExecute('UPDATE `plugins...')
#2 /srv/app/vendor/craftcms/cms/src/services/Plugins.php(597): yii\db\Command->execute()
#3 /srv/app/vendor/craftcms/cms/src/controllers/PluginsController.php(147): craft\services\Plugins->savePluginSettings(Object(nystudio107\seomatic\Seomatic), Array)
#4 [internal function]: craft\controllers\PluginsController->actionSavePluginSettings()
#5 /srv/app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#6 /srv/app/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#7 /srv/app/vendor/craftcms/cms/src/web/Controller.php(74): yii\base\Controller->runAction('save-plugin-set...', Array)
#8 /srv/app/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-plugin-set...', Array)
#9 /srv/app/vendor/craftcms/cms/src/web/Application.php(244): yii\base\Module->runAction('plugins/save-pl...', Array)
#10 /srv/app/vendor/craftcms/cms/src/web/Application.php(452): craft\web\Application->runAction('plugins/save-pl...', Array)
#11 /srv/app/vendor/craftcms/cms/src/web/Application.php(228): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#12 /srv/app/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#13 /srv/app/web/index.php(21): yii\base\Application->run()
#14 {main}
Additional Information:
Array
(
    [0] => HY000
    [1] => 1366
    [2] => Incorrect string value: '\xF0\x9F\x9A\xA7",...' for column 'settings' at row 1
)

Could this be a limitation of the SEOmatic implementation, or my database configuration?

@Wiejeben Wiejeben changed the title Unable to use emoticon as devMode title prefix Unable to use emoji as devMode title prefix Apr 15, 2018
@khalwat
Copy link
Collaborator

khalwat commented Apr 16, 2018

I don't think it's a limitation of SEOmatic, I think it's a limitation of MySQL.

https://stackoverflow.com/questions/8709892/mysql-throws-incorrect-string-value-error

craftcms/cms#2513

craftcms/cms#2527

I guess it boils down to "how bad do ya want it?" Because it appears there are work-arounds, but it may be non-trivial. For sure, switching to PostgreSQL for instance would solve it. It's possible that changing the MySQL encoding to utf8mb4 would do it too.

Let me know how it turns out.

@khalwat khalwat closed this as completed Apr 16, 2018
@Wiejeben
Copy link
Contributor Author

Thanks for enabling this feature after all 🍪

@khalwat
Copy link
Collaborator

khalwat commented Jun 30, 2018

Yeah it actually ends up being a really good idea, I wish I'd done it sooner!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants