如何在c++中模拟js-decodeURIComponent

how to mimic the js decodeURIComponent in c++?

本文关键字:模拟 js-decodeURIComponent c++      更新时间:2023-10-16

我有一个字符串(uri)需要在c++中解码,它必须是js-decodeURIComponent函数这样这个字符串:

http://external.ak.fbcdn.net/safe_image.php?d=AQBuv4KHE_CDlCPV&w=130&h=130&url=http00253A00252F00252Fi1.ytimg.com00252Fvi00252F8dWcLkK62lM00252Fhqdefault.jpg

会是这样的:

http://i1.ytimg.com/vi/8dWcLkK62lM/hqdefault.jpg

有没有一些小类可以处理c++中的所有uri编码?感谢

如果您正在寻找一个小型的跨平台库来实现这一点,请考虑使用uriparser。BSD许可证和无外部依赖

签出http://uriparser.sourceforge.net/

它是一个C库,所以在C++下使用它没有问题

跨平台Windows、Linux等。在linux下,你可以用apt-get安装它。