Accent and HTML problems with Node.js

Asked

Viewed 475 times

0

Guys, I’m creating a Microsoft Bot for Messenger, but I’m having problems with the emphasis on the texts and the html is being displayed in the reply.

Code:

   switch (session.message.text) {

    case 'Contato':

        session.send("<h3>Aqui estão alguns meios de contato:</h3><br>" +
            " <strong>Email:</strong> [email protected] <br>" +
            " <strong>Telefone 1:</strong> (35) 3435-5922 <br>" +
            " <strong>Telefone 2:</strong> (35) 3435-3635 <br>" +
            " <h3>Endereço:</h3> <br>" +
            " <strong>Unidade 1:</strong> Praça Presidente Vargas, n°62, Sala 11 – Centro, Extrema MG <br>" +
            " <strong>Unidade 2:</strong> Avenida Salvador Markowicz, n°135, sala 403 – Edifício Carraro Tower – Bragança Paulista SP <br>" +
            " <strong>Visite nosso site:</strong> www.cadabrapublicidade.com.br");
        break;




   bot.dialog('showProducts', function (session) {
   var msg = new builder.Message(session);
   msg.attachmentLayout(builder.AttachmentLayout.carousel)
   msg.attachments([

    new builder.HeroCard(session)
        .title("Contato")
        .subtitle("Entre em contato Conosco!")
        .text("")
        .images([builder.CardImage.create(session, 'http://cadabrapublicidade.com.br/wp-content/uploads/2015/08/contato_cadabra_publicidade.jpg')])
        .buttons([builder.CardAction.imBack(session, 'Contato', "Ver mais")]),

How He Displays:

inserir a descrição da imagem aqui

  • session comes from where?

  • I edited the question, Lucas.

  • Is there any UTF-8 in that file?

  • I tried to install the uft8 package by NPM, and called with require in app.js: var utf8 = require('utf8'); :(

  • Funny is that if I run another project by terminal with the command: "Node app.js" without using Visual Studio, it works normal.

  • The problem is in the project with Visual Studio. I use it to deploy to Azure more easily.

  • Have you tried the iso-8859-1?

  • Yeah, but it didn’t work.

  • You are giving error when installing some packages via npm. npm WARN [email protected] No Repository field. npm WARN [email protected] No License field.

  • I tried to put the license, but none works.

  • So guys, I solved the problem of the accents by configuring the login and FTP password in Azure, then I deployed the bot without creating another project in Visual Studio, just using the sublime msm to encode. The other problem was the HTML being displayed along with the text in messenger... Messenger probably does not accept HTML code, in other apps, (like Teams for example) works normal. To format the text in messenger, I’ll have to find another way. Vlw Galera!

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.