🐛 添加 xml 文档转义
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
"html"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@@ -159,6 +160,8 @@ func GetVoice(text, voiceName, rate, pitch, outputFormat string) ([]byte, error)
|
|||||||
|
|
||||||
// GetSsml 生成 SSML 格式的文本
|
// GetSsml 生成 SSML 格式的文本
|
||||||
func GetSsml(text, voiceName, rate, pitch string) string {
|
func GetSsml(text, voiceName, rate, pitch string) string {
|
||||||
|
// 对文本进行转义
|
||||||
|
text = html.EscapeString(text)
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
<speak xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="http://www.w3.org/2001/mstts" version="1.0" xml:lang="zh-CN">
|
<speak xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="http://www.w3.org/2001/mstts" version="1.0" xml:lang="zh-CN">
|
||||||
<voice name="%s">
|
<voice name="%s">
|
||||||
|
|||||||
Reference in New Issue
Block a user