Tags: style blog http color io using AR java forPhone end insert emoji expression, save to database times wrong:caused By:java.sql.SQLException:Incorrect string value: ' \xf0\x9f\x98\x84 ' forColumn ' Review ' at row 1At com.mysql.jdbc.SQLError.createSQLException (Sqlerror.java:1074) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (Mysqlio.java:4096) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (Mysqlio.java:4028) at Com.mysql.jdbc.MysqlIO.sendCommand (Mysql
Problem: The Emoji expression is stored in 4 bytes, so the traditional MySQL utf-8 encoding can only be stored for a maximum of 3 bytes.FIX: Modify MySQL (5.5.3 or above) encoded as UTF8MB4 to store the emoji table, and set the set names UTF8MB4 otherwise the program writes and reads garbled. Requirements: MySQL 5.5.3 or more (online said), I did not test, I use MySQL 5.6 pro-test, can be stored.To modify t
How do I encapsulate a similar expression-recording keyboard?The following knowledge is required to implement this keyboard:Notification pass value, block pass value, delegate mode, CoreData cache most recent usage record,Use AutoLayout Auto layout, keyboard animation, make plist fileProperty string attributestring. Recording Avfoundation Frame:Honey Chat Love https://itunes.apple.com/cn/app/mi-liaolove/id939936656?mt=8Original source: http://blog.csdn.net/yangbingbinga/article/details/43077595H
Can be used in controls such as iOS Uilabel,uitextview,uialertviewUse the following methodNSString *s = [NSString stringwithformat:@ "This was a smiley \ue415%c face", 0xe05a]; NSLog (@ "one----%@", s); Label.text=s; The following are the corresponding emoticons, but the code in the new SDK has changed, please refer to the official Apple document against the http://opensource.apple.com/source/ICU/ICU-461.13/icuSources/data/ Translit/any_softbanksms.txtLike the first smiley face, \ue415 need t
Solution for inputting Emoji into MySQL database1. Check the tomcat background log. The core error message is as follows:Caused by: java. SQL. SQLException: Incorrect string value: '\ xF0 \ x9F \ x98 \ x97 \ xF0 \ x9F...' for column 'content' at row 12. Modify the character set of the table field to utf8mb4:Alter table UGC_REVIEW_CONTENT MODIFY 'content' text character set utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT 'comment content ';3. Modify the tab
/***translatesasequenceofutf-8bytestotheir Equivalentunicodecodepoints.*eachcodepointisprefixed with "\u" .** @param string $utf 8** @return string */functionutf8_to_unicode ($utf 8) { $i =0; $l =strlen ($utf 8); $out = "; while ($i This article is from the "7804265" blog, please be sure to keep this source http://7814265.blog.51cto.com/7804265/1862517PHP emoji UTF8 to Unicode
Environment:All character sets for project DB have been initialized to Utf-8, as shown in the status command:Server Characterset:utf8Db Characterset:utf8Client Characterset:utf8Conn. Characterset:utf8First, modify the corresponding project database level character set:Mysql> Show CREATE Database yyf;+----------+--------------------------------------------------------------+| Database | Create Database |+----------+--------------------------------------------------------------+| YYF | CREATE DATA
(I) Preface
In order to cope with opportunities and challenges of the wireless Internet, and to avoid problems caused by emoji,
We recommend that you use the utf8mb4 character set in advance for MySQL databases involving wireless connection.
This must be a key point of technology selection in the mobile Internet industry.
(Ii) Restrictions
Required> = MySQL 5.5.3 and slave database must also be 5.5. Earlier versions do not support this character
(I) Preface
In order to cope with opportunities and challenges of the wireless Internet, and to avoid problems caused by emoji,
We recommend that you use the utf8mb4 character set in advance for MySQL databases involving wireless connection.
This must be a key point of technology selection in the mobile Internet industry.
(Ii) Restrictions
Required> = MySQL 5.5.3 and slave database must also be 5.5. Earlier versions do not support this character set o
How does PHP handle the emoji characters submitted by mobile?
Now the mobile side provides a lot of expressions, such as Baidu Input method in the expression.
A lot of expressions in PHP, after it is not recognized content, when stored in MySQL, it will start from the expression position, the contents of the back will be lost.
such as user input: Start content [Emoticons] End content
Get it in PHP and save it in MySQL only: start content [
Is th
(Val);}Export function Unicodetoarray (val) {Return Val.match (reunicode) | | [];}Export function Asciitoarray (val) {Return Val.split (");}Yes, a lot of regular. It's a headache to watch. This method can be satisfied, the expression is transferred to a portion of the group. In this case, we can only use the judgment array.Then according to the resulting array, go to each one to determine the length of each; The code is as follows:Let Strarr = Utils.toarray (val);Let str = ", strlen = 0, num =
(collate) is not the same, so you need to specify the rules of comparison, utf8mb4_unicode_ci is utf8mb4 the character set corresponding to the comparison rules. For example, if the character set is a utf8mb4 database, execute the SQL statement: select * from boy where name=‘xueweihan‘ you need to filter the records in the database with the specified collate rules.Use PostureTo create a database:CREATE DATABASE mydatabase CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;To connect to a database
Mobile input allows input expression, the expression is actually UTF-16 encoding, in the database storage will be lost, currently if the database Loadline code modified to UTF8MB4 can also be saved.If you do not want to modify the others, you can convert these emoji to the HTML character entity save.The code is as follows:Functionutf16_to_entities () { $content =mb_convert_encoding ($content, ' utf-16 '); $bin =bin2hex ($content); $arr = str_split ($
Reason:The UTF-8 encoding can be two, three, and four bytes. The emoji expression is 4 bytes, while MySQL UTF8 encodes up to 3 bytes, so data cannot be plugged in.Workaround:Convert MySQL encoding from UTF8 to UTF8MB4Steps:1. Modify the MySQL configuration file My.inidefault-character-Set=utf8mb4character-set-SERVER=UTF8MB42. Join[Client]port=3306default-character-Set=Utf8mb4[mysqld] Add character -Set-client-handshake= falsecollation-server= utf8mb4_
But we can replace it with a regular:
Copy the Code code as follows:
function Dhtmlspecialchars ($string) {if (Is_array ($string)) {foreach ($string as $key = = $val) {$string [$key] = Dhtmlspecialchars ($val);}} else {$string = Preg_replace ('/ (# (\d{3,5}|x[a-fa-f0-9]{4}) |[ a-za-z][a-z0-9]{2,5});)/', ' \\1 ',Str_replace (Array (' ', ' ' ', ' }return $string;}?>
The above describes the special emoji encyclopedia PHP special character process
: This article mainly introduces how to remove emoji. For more information about PHP tutorials, see.
public static function removeEmoji($text) { $clean_text = ""; // Match Emoticons $regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u'; $clean_text = preg_replace($regexEmoticons, '', $text); // Match Miscellaneous Symbols and Pictographs $regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u'; $clean_text = preg_replace($regexSymbols, '', $clean_text);
Today, I made a function to get fans. I found that inserting nicknames into the database should have enough Incorrectstringvalue: 39; xF0x9Fx98x84xF0x9F find the point of information found that UTF-8 encoding may be two, three, four bytes. Today, Emoji provides a function for getting fans and finds that an error is returned when inserting nicknames into the database. the length must be enough.
Incorrect string value: '\ xF0 \ x9F \ x98 \ x84 \ xF0
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.