试图让卷毛工作
这是红宝石代码
msg = "john's message"
@body = %Q|{"body":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"#{msg}"}]}]}}|.gsub("'"){"\\'"}
puts @body
curl_call = %Q|curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer xxxx' -d '#{@body}' --url 'https://api.atlassian.com/site/xxxx/conversation/xxxx/message'|
puts curl_call
system(curl_call)
这是错误:sh: 1: Syntax error: Unterminated quoted string
对建议开放
答案 0 :(得分:0)
当您使用unicode编码('
)替换\u0027
时,它可以正常工作:
.gsub("'", "\u0027")