BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

showing special character (’) instead of ‘ (apostrophe) character

Open ac-vikram opened this issue 9 years ago • 21 comments

We are updating the latest version of botchat.js (0.11.0 ) with our some customized code. However, we are getting one issue, it is showing special character (’) instead of ‘ (apostrophe) character. It was working fine with previous botchat.js. We want to use Adaptive card functionality that is why we need latest version of botchat.js Please suggest how can we handle this issue?

ac-vikram avatar Aug 07 '17 02:08 ac-vikram

Hello, can you please provide a sample message that exhibits this behavior?

danmarshall avatar Aug 07 '17 16:08 danmarshall

Actual - Here it is… Floating holiday for New Year’s Day on Sunday, 1-Jan-2017 Expected- Here it is... Floating holiday for New Year's Day on Sunday, 1-Jan-2017

ac-vikram avatar Aug 08 '17 02:08 ac-vikram

ok, can you provide the actual code or JSON with this string?

danmarshall avatar Aug 08 '17 05:08 danmarshall

We are using inline webchat like - https://github.com/Microsoft/BotFramework-WebChat#easy-in-your-non-react-website-run-webchat-inline done here. There is no other change. Just we are updating the botchat.js from https://unpkg.com/[email protected]/botchat.js. It was working fine with previous botchat.js.

ac-vikram avatar Aug 09 '17 05:08 ac-vikram

Well, the "actual" that you provided also has that same issue: image So I don't have a way to get the real message that is causing the issue.

danmarshall avatar Aug 09 '17 19:08 danmarshall

Actual means, currently it's showing like this - (Here it is… Floating holiday for New Year’s Day on Sunday, 1-Jan-2017) with new botchat.js. Expected means, earlier it was showing like this - ( Here it is... Floating holiday for New Year's Day on Sunday, 1-Jan-2017) with previous botchat.js and we want it now with new botchat.js.

ac-vikram avatar Aug 10 '17 16:08 ac-vikram

Hello @ac-vikram - I am not able to reproduce the error: image

So let's get more technical :-) please provide a code sample. Also, can you tell me if you are using the iframe WebChat from Bot Framework, or hosting your own web page with the WebChat.

If you are hosting your own page, make sure to set the charset=UTF-8 in the bot server and in the bot client: For the webserver (i.e. IIS, Azure, etc) set the Content-Type: text/html; charset=UTF-8 For the client (index.html) set meta charset="UTF-8" tag inside the head tag.

danmarshall avatar Aug 10 '17 17:08 danmarshall

I can reproduce this reliably for things like three dots in a row (...), on Safari and Chrome on OSX, and probably for a number of other character combinations as well.

However, for me setting <meta charset="UTF-8"> on the client index.html fixes the issue.

jalkanen avatar Aug 21 '17 14:08 jalkanen

Similar issue: #553 also solved with the UTF-8 meta tag. Closing this for now, as this seems to be the solution.

danmarshall avatar Aug 21 '17 16:08 danmarshall

Looks like our samples all set UTF-8 so I'm comfortable leaving it at that.

billba avatar Aug 21 '17 18:08 billba

Hey me and my team are facing the same issue and i can assure you that we have added the right meta tags in all the right server side and client side pages. we recently updated BotChat.js to render adaptive cards, and ever since this update we are unable to render UTF-8. Is there any section inside the BotChat.js where i can force render it to a particular format?

harigovind2102 avatar Sep 18 '17 18:09 harigovind2102

@harigovind2102 - We were able to resolve this issue by downloading botchat.js file from IE browser. When we use chrome browser to download botchat.js file it includes junk characters automatically. I hope it will solve your problem as well.

ac-vikram avatar Sep 19 '17 02:09 ac-vikram

@compulim is the CDN version stripping UTF8 encoding?

danmarshall avatar Sep 19 '17 16:09 danmarshall

@harigovind2102 - can you please specify the URL where your botchat.js is being served? Is this from your own server, or from a CDN?

danmarshall avatar Sep 19 '17 22:09 danmarshall

@danmarshall - your CDN is stripping the UTF8 encoding. https://cdn.botframework.com/botframework-webchat/latest/botchat.js Search for aacute and you'll see all the characters are incorrect.

mjarmstrong avatar Jan 22 '18 20:01 mjarmstrong

Please track on #1071

corinagum avatar Nov 28 '18 22:11 corinagum

I also faced this issue, then I created the message with below formats in 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);

Refer Official URL for V3: https://docs.microsoft.com/en-us/azure/bot-service/nodejs/bot-builder-nodejs-message-create?view=azure-bot-service-3.0

sivanandh avatar Feb 27 '19 08:02 sivanandh

I am also facing the same issue. I am taking the botchat.js from this link https://webchat.botframework.com/scripts/webchat-stable/botchat.js and using beautifier.io changing to appropriate js file. I am getting special (’) instead of ' (apostrophe) character.

SwedhaBalasubramanian avatar Mar 05 '19 05:03 SwedhaBalasubramanian

i am also facing this issue :

<!DOCTYPE html> <html lang="en-US"> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

isathish avatar Apr 09 '19 12:04 isathish

facing same issue

Pratiktarade avatar Mar 04 '20 06:03 Pratiktarade