Paramita
Home
Blog
Moment
Snippet
About
代码笔记
Categories
Blog (42)
Featured Tags
alpinejs (2)
ant-design (5)
antd (1)
aspose (1)
aws (1)
cloudflare (1)
dva (2)
echo (2)
filamentphp (1)
gin (1)
git (1)
github (2)
go-mecab (1)
golang (15)
goquery (1)
grpc (1)
japanese (1)
java (1)
lambda (1)
laravel (8)
leetcode (5)
less (1)
linux (3)
livewirejs (1)
mac (1)
mysql (2)
nestjs (1)
nginx (1)
nodejs (1)
npm (1)
php (5)
popclip (1)
ppt (1)
r2 (1)
react (3)
reactjs (9)
remixicon (1)
s3 (1)
shell (2)
tailwindcss (2)
taro (3)
tarojs (1)
telescope (2)
typeorm (1)
umi (1)
umijs (3)
workers (1)
zustand (2)
免签 (1)
小程序 (4)
支付宝 (1)
Blog
42 posts
Blog
is the place to record my codinglife.
««
«
6
7
8
9
10
»
»»
Aspose Slide 生成图片缩略图中文乱码
Nov 15, 2022
One minute read
aspose slide生成图片缩略图中文乱码 使用aspose slide 给ppt生成图片缩略图,mac上没问题,部署到服务器上,生成的缩略图中文全部都是方块 把mac的字体传到服务器上还是不行,读取ppt时会出现 class com.aspose.slides.PptxReadException: Index 32 out of bounds for length 32 ---> class com.aspose.slides.ms.pbdb106a0.bt com.aspose.slides.avm.do(Unknown Source) com.aspose.slides.Presentation.int(Unknown Source) com.aspose.slides.Presentation.if(Unknown Source) com.aspose.slides.Presentation.<init>(Unknown Source) com.aspose.slides.Presentation.<init>(Unknown Source) 这个错误,后来换成使用win10的字体可以了 centos7的步骤 把字体上传到 /usr/share/fonts/win 目录 cd /usr/share/fonts/win mkfontscale //建立索引 fc-cache //刷新缓存 fc-list //查看字体列表 fc-list :lang=zh......
blog
aspose
ppt
goquery 处理中文网页
Nov 9, 2022
One minute read
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 爬虫处理网页,标签用的gb2312字符集,goquery拿到的是乱码 刚开始用的 func DecodeToGBK2312(text string) string { dst := make([]byte, len(text)*2) tr := simplifiedchinese.HZGB2312.NewDecoder() nDst, _, _ := tr.Transform(dst, []byte(text), true) return string(dst[:nDst]) } 还是乱码。。。。 后来在wiki里找了一种方法 func detectContentCharset(body io.Reader) string { r := bufio.NewReader(body) if data, err := r.Peek(1024); err == nil { if _, name, ok := charset.DetermineEncoding(data, ""); ok { return name } } return "utf-8" } // DecodeHTMLBody returns an decoding reader of the html Body for the specified `charset` // If `charset` is empty, DecodeHTMLBody tries to guess the encoding from the content func DecodeHTMLBody(body io.Reader, charset string) (io.Reader, error) { if charset == "" { charset = detectContentCharset(body) } e, err := htmlindex.Get(charset) if err != nil { return nil, err } if name, _ := htmlindex.Name(e); name != "utf-8" { body = e.NewDecoder().Reader(body) } return body, nil } 试了下如果......
blog
golang
goquery
fix Cloudflare R2 Network connection lost error
Nov 1, 2022
2 minutes read
想白嫖下cloudflare的R2,workers上传文件的时候总是会出现Network connection lost error错误, 用的Hono包,完全照着cloudflare的官方文档抄 export const AddFile = async (c: Context): Promise<Response> => { //save object const data = await c.req.formData(); const file: File = data.get("file") as File; const name = await md5(file) as string; const bucket = c.env.DRIVE as R2Bucket try { const saved = await bucket.put(name, file, { httpMetadata: { contentType: file.type }, customMetadata: { createdAt: Date.now().toString(), } }) } catch (e) { console.log(e) return Error(c, CODE_CLOUDFLARE_SERVICE_FAILED, 'service unavailable,please try again later') } return Success(c, 'ok') } 结果总是网络链接断开,用wrangler还有网站的Real-time Logs 啥信息都看不出来......
blog
cloudflare
workers
R2