c# - 在 html 音频播放器标签中编码和解码 #,& 和 + 符号
问题描述
我有一个 Angular 6 应用程序,其中有一些 html 音频播放器部分。我已经通过标签对mp3
文件进行了编码encodeURIComponent
并在其中使用。src
以下播放器的音频播放正常
<audio controls>
<source src="www.test.com/api/downloadaudio?filename=test.mp3" type="audio/mp3">
</audio>
对于像 #, & 和 + 这样的特殊符号,它按照如下方式编码encodeuricomponenet
并应用在源标签中,如下所示
文件名 -Test#1.mp3
文件名 -Test&2.mp3
文件名 -Test+1.mp3
<audio controls>
<source src="www.test.com/api/downloadaudio?filename=test%231.mp3" type="audio/mp3">
<source src="www.test.com/api/downloadaudio?filename=test%262.mp3" type="audio/mp3">
<source src="www.test.com/api/downloadaudio?filename=test%2B3.mp3" type="audio/mp3">
在 API 端(C#)它没有被正确解码。我在 C# 端得到以下值
对于 1,2 和 3 case-> test是我得到的文件名值,而不是test#1
, test&2
,test+3
让我知道这里做错了什么......
谢谢,
塞尔瓦
解决方案
推荐阅读
- c# - 如何将 .net 包从 Visual Studio 部署到 Sharepoint 开发人员站点?
- java - 创建休眠本机查询时出现查询语法异常
- html - 滚动事件未在 Angular-6 中触发
- wpf - 将所有打开的应用程序的窗口移动到预定义的位置
- c# - 将来自多个来源的调用限制为单个方法
- macos - 终止 Vue CLI 3 开发服务器的正确方法是什么?
- android - 在 ViewPager 中重新加载片段时的问题
- android - 如何在检测特定短语和滚动位置的点击时在 Android 中显示 HTML 文本?
- android - StartForeground() 杀死应用程序后清除通知
- vb.net - 为什么我收到错误:BC30452 Operator '&' is not defined for types 'String' and 'Image', for this code?