what: confluence页面预览含有中文的附件时乱码
why:Linux服务器上 缺少中文字体
how:
一、安装字体
1、拷贝字体:linux上/usr/share/fonts/路径下新建目录msttcore,将windows的C:\Windows\Fonts的字体文件拷贝到/usr/share/fonts/Fonts目录下。
2、 修改字体配置文件,新增上一步新建的目录
vim /etc/fonts/fonts.conf
<!-- Font directory list -->
<dir>/usr/share/fonts</dir>
<dir>/usr/share/fonts/msttcore</dir>
<dir>/usr/share/X11/fonts/Type1</dir> <dir>/usr/share/X11/fonts/TTF</dir> <dir>/usr/local/share/fonts</dir>
<dir prefix="xdg">fonts</dir>
<!-- the following element will be removed in the future -->
3、不联网安装fontconfig
https://centos.pkgs.org/ 搜索相应的包和依赖,放到服务器上(可以联系我,提供以下四个包)
依次安装:rpm -ivh 包名.rpm
联网状态下可参考:https://blog.csdn.net/qq_33334411/article/details/111690260
4、刷新内存中的字体缓存 fc-cache
5、查看字体列表fc-list
查看linux已安装中文字体 fc-list :lang=zh
二、在Confluence中设置
1、在confluence的安装目录, 如/opt/atlassian/confluence/bin下找到setenv.sh, 找到CATALINA_OPTS, (vi /opt/atlassian/confluence/bin/setenv.sh, SHIFT+G 到最后一行), 在export CATALINA_OPTS 前加入一行
CATALINA_OPTS="-Dconfluence.document.conversion.fontpath=/usr/share/fonts/Fonts/ ${CATALINA_OPTS}"
注意${CATALINA_OPTS} 前面有一个空格
2、清空confluence的缓存:
home下viewfile目录和shared-home/dcl-document目录里的所有缓存文档文件, 不清空的话, confluence预览旧文件时还是会显示方框,只有新文件才会正常.
可先备份,不备也可以。。
#备份目录
cp -r /var/atlassian/application-data/confluence/viewfile/ /root/viewfile_20220915
cp -r /var/atlassian/application-data/confluence/shared-home/ /root/shared-home_20220915
cp -r /var/atlassian/application-data/confluence/thumbnails/ /root/thumbnails_20220915
删缓存
rm -rf /var/atlassian/application-data/confluence/viewfile/*
rm -rf /var/atlassian/application-data/confluence/thumbnails/*
rm -rf /var/atlassian/application-data/confluence/shared-home/dcl-document/*
rm -rf /var/atlassian/application-data/confluence/shared-home/dcl-document_hd/*
rm -rf /var/atlassian/application-data/confluence/shared-home/dcl-thumbnail/*
3、重启confluence就OK了
cd /opt/atlassian/confluence/bin
sh shutdown.sh && sh startup.sh
or
/opt/atlassian/confluence/bin/restart.sh
如果出现PID存在,start abort的情况可以kill -9 XXX杀死进程,重新start
参考:
https://confluence.atlassian.com/confkb/the-text-in-a-powerpoint-excel-or-word-document-looks-different-when-using-the-viewfile-macro-200213562.html
参考链接:
https://www.jianshu.com/p/bb6cdb3a1cb3
https://www.jianshu.com/p/b5744bb21115
https://blog.csdn.net/alittleyatou/article/details/78329387
https://blog.csdn.net/zhulianseu/article/details/126870709
安装字体:
https://www.jianshu.com/p/998b93b9a1fe
https://blog.csdn.net/ouyangzhenxin/article/details/82387632
https://blog.csdn.net/qq_33334411/article/details/111690260
https://www.jianshu.com/p/09d3b1a6450b
https://www.cnblogs.com/dw3306/p/13722556.html
https://blog.espnlol.com/?p=548
https://blog.csdn.net/weixin_34354945/article/details/91775064
https://blog.csdn.net/axin1240101543/article/details/83585069
如果有其他页面乱码问题,可参考:
https://blog.csdn.net/ethnicitybeta/article/details/122595939