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

无法添加内容和导入内容 #843

Open
russellyi opened this issue Jun 11, 2018 · 9 comments
Open

无法添加内容和导入内容 #843

russellyi opened this issue Jun 11, 2018 · 9 comments
Labels
BUG

Comments

@russellyi
Copy link

@russellyi russellyi commented Jun 11, 2018

Incorrect string value: '\xE5\xAD\xA6\xE6\xA0\xA1...' for column 'Title' at row 1

在 MySql.Data.MySqlClient.MySqlStream.ReadPacket() 
在 MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) 
在 MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) 
在 MySql.Data.MySqlClient.MySqlDataReader.NextResult() 
在 MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) 
在 MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() 
在 SiteServer.CMS.Data.DbHelper.ExecuteNonQuery(IDbCommand command) 
在 SiteServer.CMS.Data.DbHelper.ExecuteNonQuery(IDbTransaction transaction, String commandText, IDataParameter[] commandParameters) 
在 SiteServer.CMS.Data.DbHelper.ExecuteNonQueryAndReturnId(String tableName, String idColumnName, IDbTransaction trans, String commandText, IDataParameter[] commandParameters) 
在 SiteServer.CMS.Data.DbHelper.ExecuteNonQueryAndReturnId(String tableName, String idColumnName, String connectionString, String commandText, IDataParameter[] commandParameters) 
在 SiteServer.CMS.Data.DataProviderBase.ExecuteNonQueryAndReturnId(String tableName, String idColumnName, String commandText, IDataParameter[] commandParameters) 
在 SiteServer.CMS.Provider.ContentDao.Insert(String tableName, IContentInfo contentInfo) 
在 SiteServer.CMS.Provider.ContentDao.Insert(String tableName, SiteInfo siteInfo, IContentInfo contentInfo, Boolean isUpdateContentNum, Int32 taxis) 
在 SiteServer.CMS.Provider.ContentDao.Insert(String tableName, SiteInfo siteInfo, IContentInfo contentInfo) 在 SiteServer.BackgroundPages.Cms.PageContentAdd.Submit_OnClick(Object sender, EventArgs e)

2018-06-11 17:50:37
@russellyi

This comment has been minimized.

Copy link
Author

@russellyi russellyi commented Jun 11, 2018

为什么创建的表默认字符集是latin1,改成utf8就可以添加内容了。

CREATE TABLE `model_content` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `ChannelId` int(11) DEFAULT NULL,
  `SiteId` int(11) DEFAULT NULL,
  `AddUserName` varchar(255) DEFAULT NULL,
  `LastEditUserName` varchar(255) DEFAULT NULL,
  `WritingUserName` varchar(255) DEFAULT NULL,
  `LastEditDate` datetime DEFAULT NULL,
  `Taxis` int(11) DEFAULT NULL,
  `GroupNameCollection` varchar(255) DEFAULT NULL,
  `Tags` varchar(255) DEFAULT NULL,
  `SourceId` int(11) DEFAULT NULL,
  `ReferenceId` int(11) DEFAULT NULL,
  `IsChecked` varchar(18) DEFAULT NULL,
  `CheckedLevel` int(11) DEFAULT NULL,
  `Hits` int(11) DEFAULT NULL,
  `HitsByDay` int(11) DEFAULT NULL,
  `HitsByWeek` int(11) DEFAULT NULL,
  `HitsByMonth` int(11) DEFAULT NULL,
  `LastHitsDate` datetime DEFAULT NULL,
  `SettingsXml` longtext,
  `Title` varchar(255) DEFAULT NULL,
  `IsTop` varchar(18) DEFAULT NULL,
  `IsRecommend` varchar(18) DEFAULT NULL,
  `IsHot` varchar(18) DEFAULT NULL,
  `IsColor` varchar(18) DEFAULT NULL,
  `LinkUrl` varchar(200) DEFAULT NULL,
  `AddDate` datetime DEFAULT NULL,
  `SubTitle` varchar(255) DEFAULT NULL,
  `ImageUrl` varchar(200) DEFAULT NULL,
  `VideoUrl` varchar(200) DEFAULT NULL,
  `FileUrl` varchar(200) DEFAULT NULL,
  `Content` longtext,
  `Summary` longtext,
  `Author` varchar(255) DEFAULT NULL,
  `Source` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `IX_model_Content` (`IsTop`,`Taxis`,`Id`),
  KEY `IX_model_Content_Taxis` (`Taxis`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@starlying

This comment has been minimized.

Copy link
Contributor

@starlying starlying commented Jun 12, 2018

对,mysql默认不支持中文

@russellyi

This comment has been minimized.

Copy link
Author

@russellyi russellyi commented Jun 12, 2018

我看了下,只有内容表 model_content 是这样latin1,其他表默认都是utf8

@starlying

This comment has been minimized.

Copy link
Contributor

@starlying starlying commented Jun 12, 2018

是有问题,系统创建内容表的时候没有加上utf8,我们会修复一下

@starlying starlying added the BUG label Jun 12, 2018
@starlying starlying mentioned this issue Jun 12, 2018
37 of 37 tasks complete
@starlying

This comment has been minimized.

Copy link
Contributor

@starlying starlying commented Jul 1, 2018

已修复

@russellyi

This comment has been minimized.

Copy link
Author

@russellyi russellyi commented Jul 27, 2018

这个问题还是存在。是否需要将utf8修改为utf8mb4

Incorrect string value: '\xF0\x9F\x98\x83' for column 'Title' at row 1

在 MySql.Data.MySqlClient.MySqlStream.ReadPacket() 在 MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) 在 MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) 在 MySql.Data.MySqlClient.MySqlDataReader.NextResult() 在 MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) 在 MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() 在 SiteServer.CMS.Data.DbHelper.ExecuteNonQuery(IDbCommand command) 在 SiteServer.CMS.Data.DbHelper.ExecuteNonQuery(IDbConnection connection, String commandText, IDataParameter[] commandParameters) 在 SiteServer.CMS.Data.DbHelper.ExecuteNonQuery(String connectionString, String commandText, IDataParameter[] commandParameters) 在 SiteServer.CMS.Provider.ContentDao.Update(String tableName, IContentInfo contentInfo) 在 SiteServer.CMS.Provider.ContentDao.Update(String tableName, SiteInfo siteInfo, IContentInfo contentInfo) 在 SiteServer.BackgroundPages.Cms.PageContentAdd.Submit_OnClick(Object sender, EventArgs e)

2018-07-27 17:12:16
@starlying

This comment has been minimized.

Copy link
Contributor

@starlying starlying commented Jul 30, 2018

感觉不像是utf8导致的

@russellyi

This comment has been minimized.

Copy link
Author

@russellyi russellyi commented Jul 30, 2018

现在数据库是不是不支持存储表情 😃(= \xF0\x9F\x98\x83)? 上面那个问题就是在内容标题上加了表情才出现的。

@starlying

This comment has been minimized.

Copy link
Contributor

@starlying starlying commented Jul 30, 2018

哦,那应该就是这个导致的,我们会把utf8改成utf8mb4

@starlying starlying mentioned this issue Jul 30, 2018
43 of 43 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.