Summernote strange characters when copying / pasting

I have a document / text that i have in Notepad.

I copy and paste the text into summernote

as you can see, the text shows up fine before saving and previewing.
However, as soon as i save and then click preview, this occurs.

i am not sure what is going on . My database table is setup with MySql - utf8_general_ci

any ideas on why this occurs? I also have used TinyMCE and don’t have this problem with the same text im using here.

thoughts?

There must be something wrong with your database collation and/or encoding.
What is your database type? And can you post a screenshot showing the db collation and the encoding for the specific table?

The ‘newsletter’ field is the one that holds the main body of the newsletter

i have also tried LongText as well for the field, but same result.

What web server are you using? And what database version exactly?
On your screenshots i see asp pages?

yes, we are running windows 2019 server IIS/10.0
Mysql v7.4.1

I have seen this with Summernote too and had to do a replace() on the string to correct for it. It seems as though it is certain Windows punctuation characters, particularly speech marks, apostrophes and back ticks when copy/pasted

so its not the database or coding on the page…its the actual summernote html editor that is causing this?

This doesn’t look like a summernote issue to me. When you paste it’s fine, but when store in the database it’s broken, so that looks like a database encoding issue.

any ideas on what the database structure should be to fix this?

I’m not saying for sure it is, but I’ve only ever seen the issue in fields that have a corresponding Summernote input when people are using Windows. I have some legacy non-Wappler pages that also use the same fields so they could easily be the cause. Also, they are more likely to paste in Summernote because of the content type meaning summernote may not be the common factor.

@BWCWeb when you look in the DB directly, what do you see there? ’ or ?

I see you altered the table to make sure it is UTF8, did you try pasting and saving the text again or just viewing what was already stored?

When i go into the database, i also see the same foreign characters. So that is being save into the database.

I also changed the database Collation and then again tried to save the same paragraph and it still stored the foreign characters.

Try setting the collation to:

latin1_swedish_ci

Remember to BACKUP your database first!

Then resubmit your form with the pasted content and see if that rectifies your issues?

We store both Portuguese and English text fields with various punctuation using the above collation settings. No issues at all recalling from the DB for display in the application.

OK. When you submit the form, are the encoded characters (’) in the submitted values in the developer tools of the browser?

Perhaps the issue is with IIS/ASP.

How to set website’s default encoding in IIS? How to fix a page that can’t display foreign language like Chinese? | Mike Mai (maideveloper.com)

I changed this...then performed the insert again...same characters appear.

i don’t see it in the submission…but when i pull the record again or view the actual database record, they are located there.

It just seems like any foreign " or comma that is on the page, is getting these odd characters.

If i go and Find / Replace in Notepad each quotation mark, it seems to allow it to update, but i don’t want to make my users do this each time.

As you are storing HTML in to the text field when you display it are you using Dynamic Attributes / Display / Inner HTML to render it?

Dave, it's not an issue with displaying the data. It's the issue storing them, as they are wrongly stored in the db:

There is something wrong with the database collation/encoding or IIS encoding settings.

Also the collation should be utf8_general_ci not latin1_swedish_ci

it seems as though its in the database when i update the newsletter in Summernote…so its displaying what is stored in the table. I do, however have the textfield displaying the html data.

@Teodor

Just throwing it out there. We store as latin1_swedish_ci and have none of these issues (storing html or otherwise). Not sure why it is happening in @BWCWeb case? Maybe @patrick is on to something, have you tried what he suggests @BWCWeb?