Go语言 清除单词后撇号发生变化

krcsximq  于 2023-01-22  发布在  Go
关注(0)|答案(1)|浏览(143)
package main

import (
"log"
"github.com/microcosm-cc/bluemonday"
)

func main() {
c := "hello doesn't work 😖"

    p := bluemonday.UGCPolicy()
    
    log.Println(p.Sanitize(c))

}

预期输出应为hello doesn't work 😖,而不是接收hello doesn't work 😖
我尝试将allowlist与regexp一起使用,但它不起作用

km0tfn4u

km0tfn4u1#

这在HTML的上下文中并不是真正的变化,正如您在下面看到的:

<div>hello doesn't work 😖</div>
<div>hello doesn&#39;t work 😖</div>

相关问题