JCHub

  • Home
  • Category
    • A/V
    • WebRTC
    • Beauty of Programming
    • Linux
    • Windows
    • Moments of Life
    • Campus Life
  • Reference
    • API Reference
    • Utilities
    • AV Test
    • Doc
  • Message Board
  • About
JCHub
Code as My Sword, Lost in Obsession
Web

FireBreath插件IE浏览器中文字符乱码问题

去年写过FireBreath插件的文章,那时刚到新公司,独自开发一款传统的视频播放器插件。后面基于Firebreath框架开发,支持IE以及Firefox。转眼一年多了,播放器插件已经成功部署在公司多个项目中,无论特色功能点,性能,稳定性,都达到令人满意的程度。最近一个项目要在IE11浏览器上跑,由于之前都是在Firefox上跑,IE上没怎么测过,所以在IE上跑时出现了个问题:接口传入的中文字符乱码。 播放器插件多个接口需要传入带中文字符参数,比如视频OSD水印,抓图位置以及图片水印,下载录像保存位置,下载录像添加的水印等等。Firebreath JSAPI接口支持std::string以及std:wstring两种类型的字符串,在Firefox上,相应接口参数设置为std:wstring即可满足传入参数带中文字符问题,但是IE11上却不行,传入的中文字符一直都是乱码。由于只支持这两种类型字符串,传入的都是乱码,所以插件内部怎么处理都不行,只能从外部入手了。 后面灵光闪现,想到对中文字符做处理,想到浏览器怎么对地址栏输入地址的处理。所以前端使用encodeURI函数编码传入的带中文参数,插件内部再解码即可,这样就可以顺利地传入带中文的参数。经测试,在IE与Firefox上,这种方法都正常运行。插件内部用到的UriDecode函数如下: [crayon-69d9dbe5bc3c3223416170/]

2019年6月3日 0comments 1440hotness 0likes Jeff Read all
Copyright Statement

Unauthorized reproduction or plagiarism in any form is strictly prohibited. For reprint requests, please contact via email.

Recent Comments
Addiea9 Published at 4 days ago(04 04202643001 08 08am26) Some called it luck. Then Sarah cashed 800K. Be ne...
snail Published at 2 weeks ago(03 03202633105 27 27pm26) 多谢,大佬。醍醐灌顶!
dongxuh Published at 9 months ago(07 07202573103 27 27pm25) 真心不错的博客,有机会能一起分享
南南 Published at 9 months ago(07 07202573103 15 15pm25) 写的超棒!
Jeff Published at 11 months ago(05 05202553105 15 15pm25) 2025-03-12的提交已经支持了
Ad

COPYRIGHT © 2026 jianchihu.net. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang