In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "java processing database does not support emoji emoticons how to solve", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to solve the problem that the java processing database does not support emoji emoticons.
Generally, utf8,utf8 does not support storing emoji in the database. Garbled code occurs when the stored Wechat nickname contains emoji. There are two solutions:
When the 1.mysql database is upgraded to version 5.5 or above, the characters changed from utf8 to utf8mb4,utf8mb4 can be up to 4 bytes, and the emoji can be stored and the database server can be restarted. This method may fail.
two。 Filter out emoji in java code for simplicity and efficiency. Here are the tool classes for filtering emoji:
Import java.util.regex.Matcher;import java.util.regex.Pattern
Public class EmojiUtil {
Public static String replace (String input) {
If (! StringUtil.isEmpty (input)) {
String patternStr = "[^\ u0000 -\ uFFFF]"
Pattern pattern = Pattern.compile (patternStr, Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE)
Matcher matcher = pattern.matcher (input)
Input = matcher.replaceAll ("")
}
Return input
}
}
At this point, I believe that everyone on the "java processing database does not support emoji emoji how to solve" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.