Search code examples
ibm-cloudibm-watsonwatson-conversation

@ character is not displayed in Watson Conversation Service response string


In working with IBM Watson Conversation Service (WCS) I want to print an email address in the response. The problem is that WCS is neglecting all the characters after @ symbol and the @ character itself.

I tried using ' and \ to escape it, but it didn't help much.

How can I print an email address in a response string?


Solution

  • If the email address is passed into the Watson Conversation service as a context variable, then it can be returned (printed) as part of the response string. Assuming the variable is named "email" and its value is "[email protected]", the following would do as response:

    Hello, your mail address is <? $email ?>
    

    It would return:

    Hello, your mail address is [email protected]
    

    However, you need to be careful if you want to print out special characters such as @. The reason is that it refers to entities. It is a shorthand. In that case you need to escape that sign with \, e.g., \@. Here is a hardcoded response:

    Please contact support at support\@example.com