当前位置:网站首页>Openfire solves the problem of Chinese garbled code after using MySQL database
Openfire solves the problem of Chinese garbled code after using MySQL database
2022-06-30 20:13:00 【Brother Xing plays with the clouds】
Openfire It's a very good one IM The server , And it's pure Java Realization , Versions with multiple platforms , His data can be stored in a variety of databases , Such as MySQL,Oracle etc. .
In actual use, the most common thing we encounter is to use MySQL Chinese garbled code behind the database , This question is very interesting , And it can be seen from the phenomenon Openfire Some internal mechanisms .
The practical problem is : First start Openfire The server , Then create a new account by using the client or directly logging in to the background , Specify some Chinese attributes for this account , Such as name, etc . If you don't restart The server , You will never feel anything wrong , Because all Chinese displays are normal . Next, restart it Openfire, Use the established account to log in to the client or enter the background management side to view , You will find that all Chinese has become a question mark . Log in to the database to view , It is found that all Chinese characters are also question marks , This illustrates two problems :
- Openfire With application layer cache
- There is a problem with the database encoding
The solution is very simple , First make sure you are openfire The database code created is utf8 Of , Build the predicative sentence as follows :
create database openfire default character set utf8 default collate utf8_general_ci
When you have already created the database , You can use it. :
alter database openfire default character set utf8 default collate utf8_general_ci;
secondly , Initializing Openfire database , That is, the first configuration Openfire The server when , The character encoding format should be added to the connection string in the connection database , Must be added to the connection UTF8 Coding requirements for , The connection string settings are as follows :
jdbc:mysql://127.0.0.1:3306/openfire?useUnicode=true&characterEncoding=utf8
If the installation is complete , This configuration can also be changed , Direct to Openfire Installation directory , find conf/openfire.xml Such a document , Open and find the following XML section , Modify the serverURL that will do
<database>
<defaultProvider>
<driver>com.mysql.jdbc.Driver</driver>
<serverURL>jdbc:mysql://127.0.0.1:3306/openfire?useUnicode=true&characterEncoding=utf8</serverURL>
Be careful : because & Has a special meaning , Therefore, the original & The symbol must be escaped as &
边栏推荐
- How to pass the PMP Exam quickly?
- Client请求外部接口标准处理方式
- S7-1500 PLC之间进行TCP通信的具体方法和步骤详解(图文)
- CV+Deep Learning——网络架构Pytorch复现系列——basenets(BackBones)(一)
- 项目经理不应该犯的错误
- pytorch实现FLOPs和Params的计算
- 以全栈全功能解决方案,应对多样工具复杂环境DevOps落地难题
- 信息学奥赛一本通 1362:家庭问题(family)
- Cv+deep learning network architecture pytoch recurrence series basenets (backbones) (I)
- 杰理之检测灵敏度级别确定【篇】
猜你喜欢
Redis ziplist 压缩列表的源码解析

【1175. 质数排列】

RP prototype resource sharing - shopping app

exness:流动性系列-流动性清洗和反转、决策区间
![Network planning | [five transport layers and six application layers] knowledge points and examples](/img/4f/31acce51b584bed5ef56b2093c4db3.png)
Network planning | [five transport layers and six application layers] knowledge points and examples

How to pass the PMP Exam quickly?

Transport layer uses sliding window to realize flow control

传输层 使用滑动窗口实现流量控制

NLP 论文领读|文本生成模型退化怎么办?SimCTG 告诉你答案

如何快速通过PMP考试?
随机推荐
网易云签到可抽奖?那一年我能签到365天。不信?你看。
杰理之触摸按键识别流程【篇】
8 - 函数
Basic syntax of VB
What is the difference between tolocal8bit and toutf8() in QT
Application of JDBC in performance test
凌云出海记 | 一零跃动&华为云:共助非洲普惠金融服务
解决arm_release_ver of this libmali is ‘g2p0-01eac0‘,rk_so_ver is ‘4‘,libgl1-mesa-dev不会被安装,存在未满足的依赖关系
The prospectus of pelt medical was "invalid" for the second time in the Hong Kong stock exchange, and the listing plan was substantially delayed
“更福特、更中国”拨云见日,长安福特王牌产品订单过万
Torchdrug -- drug attribute prediction
分析超700万个研发需求发现,这八大编程语言才是行业最需要的
【ICCV 2019】特征超分检测:Towards Precise Supervision of Feature Super-Resolution for Small Object Detection
PHP文件上传小结(乱码,移动失败,权限,显示图片)
mysql登录出现1045错误修改方法[通俗易懂]
毕业季职场人
QT QStringList用法
【论文阅读】Trajectory-guided Control Prediction for End-to-end Autonomous Driving: A Simple yet Strong Baseline
Solution to rollback of MySQL database by mistake deletion
GeoServer installation