0

我的 API for Rails 应用程序有一个控制器。但是,收到的消息附加了 6 个下划线。@message.message = CGI.unescape(params[:message]).strip字符串附加了@message.message额外的 6 个下划线。例如; @message.message例如,以 value 结尾"Hi, Joseph and Beatrice invite you for our wedding day preparation meetings Fridays, starting 5/10/2012 at Calvary Chapel Kampala - William Street Gadith ______" 的控制器如下图所示;

def sms
    @message = Message.new
    decoded_to = CGI.unescape(params[:to])
    #@message.to = decoded_to.gsub(/[^\d]/,"")
    @message.to = CGI.unescape(params[:to]).strip.gsub("+","").gsub(/\s+/, "")
    @message.from =  CGI.unescape(params[:from])
    @message.message = CGI.unescape(params[:message]).strip
    @message.user_id = current_user.id
    @message.status = 'Queued'
    if @message.save
        MessageWorker.perform_async(@message.id, [""], current_user.id)
        render json: {status: "Success"} 
    else
        render json: {status: "Failed" }
    end
end

可能是什么问题呢?

感谢所有帮助。

4

0 回答 0