以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- JSON中的汉字解析 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=153599) |
||||
-- 作者:fczhaobo -- 发布时间:2020/8/16 21:49:00 -- JSON中的汉字解析 {"name":"1fb7f431-357b-4cea-97bb-78f43702e87a","time_start":45440,"time_end":46540,"layer":1,"text":"%E8%BD%AC%E8%BD%B4%E6%9D%A5%E7%94%BB","group":1,"ismother":false,"ischild":false,"ishiden":false,"format":{"IB":false,"II":false,"IU":false,"IS":false,"HC":false,"TC":"FFFFFF","AL":2,"FM":0,"V4N":"","CS":false,"V4S":"Default","V4ML":0,"V4MR":0,"V4MV":0,"V4E":""}} "text":"%E8%BD%AC%E8%BD%B4%E6%9D%A5%E7%94%BB",如何解码成汉字呢?
|
||||
-- 作者:有点蓝 -- 发布时间:2020/8/16 22:24:00 -- 直接解析即可:http://www.foxtable.com/mobilehelp/topics/0140.htm Dim json As String = 上面的json字符串
Dim jo As JObject = JObject.Parse(json) Output.Show(jo("text")) |
||||
-- 作者:fczhaobo -- 发布时间:2020/8/21 10:52:00 -- "text":"%E8%BD%AC%E8%BD%B4%E6%9D%A5%E7%94%BB" , |
||||
-- 作者:fczhaobo -- 发布时间:2020/8/21 10:53:00 -- 应该是编码的问题 |
||||
-- 作者:fczhaobo -- 发布时间:2020/8/21 10:54:00 -- 我是从UTF9的文本文档里提取的JSON字符串 |
||||
-- 作者:linyunu1 -- 发布时间:2020/8/21 11:11:00 -- dim s as string = "%E8%BD%AC%E8%BD%B4%E6%9D%A5%E7%94%BB" msgbox(UrlDecode(s))
|
||||
-- 作者:有点蓝 -- 发布时间:2020/8/21 11:12:00 -- 文档发过来测试一下 |
||||
-- 作者:fczhaobo -- 发布时间:2020/8/21 11:24:00 -- Dim atpj As WinForm.TextBox = e.Form.Controls("atpj文件") Dim mp3 As WinForm.TextBox = e.Form.Controls("mp3文件") Dim mulu As WinForm.TextBox = e.Form.Controls("目录")
Dim FileName As String = ProjectPath & "\\tempfiles\\mp3topcm.bat" \'生成日志文件 Dim i As Integer=0 Dim tstart As String Dim tend As String Dim cha As String Dim cd As Integer Dim r As Row Dim jsontxt As String If atpj.value IsNot Nothing Then jsontxt = FileSys.ReadAllText(atpj.value) Else MessageBox.show("请准确选择待识别的atpj专用文件") Return End If Dim jo As JObject = Jobject.Parse(jsontxt) If jo("BLOCKS") IsNot Nothing Then For Each jt As JToken In jo("BLOCKS") r= Tables("语音识别临时表").AddNew() tstart=jt("time_start").ToString tend=jt("time_end").ToString cha=tend-tstart r("编号")=Format(i,"0000") r("名称")=jt("name") r("开始时间")=Functions.Execute("时间转换",tstart) r("结束时间")=Functions.Execute("时间转换",tend) r("时长")=Functions.Execute("时间转换",cha) r("识别内容")=jt("text").ToString r("结束编码")=jt("time_end").ToString r("pcm路径")=ProjectPath & "tempfiles\\" & Format(i,"0000") & ".pcm" r.save Dim s As String= "ffmpeg -accurate_seek -i " & mp3.value & " -ss " & r("开始时间") & " -t " & r("时长") & " -acodec copy " & ProjectPath & "tempfiles\\" & Format(i,"0000") & ".mp3" & vbcrlf & "ffmpeg -y -i " & ProjectPath & "tempfiles\\" & Format(i,"0000") & ".mp3 -acodec pcm_s16le -f s16le -ac 1 -ar 16000 " & ProjectPath & "tempfiles\\" & Format(i,"0000") & ".pcm" & vbcrlf FileSys.WriteAllText(FileName,s, True, Encoding.UTF8) i=i+1 Next End If
|
||||
-- 作者:有点蓝 -- 发布时间:2020/8/21 12:05:00 -- 汗,这种是url编码:http://www.foxtable.com/mobilehelp/topics/0241.htm r("识别内容")=UrlDecode(jt("text").ToString)
|
||||
-- 作者:fczhaobo -- 发布时间:2020/8/21 15:54:00 -- 谢谢了 |