【问题标题】:Microsoft Bot Framework Special CharactersMicrosoft Bot Framework 特殊字符
【发布时间】:2017-11-25 08:49:08
【问题描述】:

我的一位同事使用 MS Bot Framework 开发了一个机器人。它按预期工作,但有些响应显示特殊字符代替撇号。请让我知道你们是否遇到过这种情况并有任何解决方法。谢谢。 :)

【问题讨论】:

  • 这看起来像一个字符编码问题,但如果不了解更多信息就很难说。能否提供详细信息和代码示例?
  • 我以为也可以,但我刚刚更新了脚本,现在似乎运行良好。感谢您的输入。 :)
  • 我希望那是 而不是 '

标签: c# bots botframework chatbot


【解决方案1】:

您可以使用正则表达式类作为最佳实践,以避免将来出现其他特殊字符。以下是您可以使用的示例

using System;
using System.Text.RegularExpressions;

class Program
{
    static void Main()
    {

        string inputString = "Manoj# Bhard@waj";
        //  . indicates any character to be removed. You can also write characters as well to remove some selected characters
        string outputString = Regex.Replace(input, ".", " ");

        // Write the output.
        Console.WriteLine(inputString);
        Console.WriteLine(outputString);
    }
}

【讨论】:

    【解决方案2】:

    我也遇到了这个问题,然后我在 MS bot Code(app.js) 中创建了以下格式的消息。

    var customMessage = new builder.Message(session)
            .text("I didn't quite get that. For us ......")
            .textFormat("plain")
            .textLocale("en-us");
        session.send(customMessage);
    

    参考V3官方网址:https://docs.microsoft.com/en-us/azure/bot-service/nodejs/bot-builder-nodejs-message-create?view=azure-bot-service-3.0

    【讨论】:

      猜你喜欢
      • 2023-01-18
      • 2023-03-11
      • 2019-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      • 2020-11-28
      • 2012-01-07
      相关资源
      最近更新 更多