TinyPortal

Development => Support => Topic started by: Lesmond on July 25, 2020, 07:32:30 PM

Title: Pasting HTML Article
Post by: Lesmond on July 25, 2020, 07:32:30 PM
Not sure if this is an error, If I copy/paste some text with smiles in it throws errors.

here is a section of something I pasted..
QuoteCan anyone remember those home Chemistry sets we could buy that contained lots of useful (and dangerous) stuff to experiment with ?😎

Type of error: Database
Database Error: Incorrect string value: '\xF0\x9F\x98\x8E\xF0\x9F...' for column 'body' at row 1
https://xxxxx.pw/index.php?action=tpadmin
/home/lesmond/public_html/forum/Sources/TPortalAdmin.php (Line 3363)


I did try pasting has plain text, but still got the error above.

I ended up going through all the text to remove the smiles and no errors 
Title: Re: Pasting HTML Article
Post by: lurkalot on July 25, 2020, 07:39:41 PM
Thanks Les.  Confirmed.
Title: Re: Pasting HTML Article
Post by: lurkalot on July 25, 2020, 07:43:04 PM
Error
Type of error: Database
Error message:
Database Error: Incorrect string value: '\xF0\x9F\x98\x8E</...' for column 'body' at row 1
File: /home/vol11_7/byethost7.com/b7_24299229/htdocs/testsite7/Sources/TPortalAdmin.php
Line: 3364
URL of page causing the error: http://lts4.byethost7.com/testsite7/index.php?action=tpadmin

Backtrace information
#0: smf_db_error()
Called from /home/vol11_7/byethost7.com/b7_24299229/htdocs/testsite7/Sources/Subs-Db-mysql.php on line 489
#1: smf_db_query()
Called from /home/vol11_7/byethost7.com/b7_24299229/htdocs/testsite7/Sources/TPortalAdmin.php on line 3364
#2: do_postchecks()
Called from /home/vol11_7/byethost7.com/b7_24299229/htdocs/testsite7/Sources/TPortalAdmin.php on line 94
#3: TPortalAdmin()
Called from unknown on line -1
#4: call_user_func()
Called from /home/vol11_7/byethost7.com/b7_24299229/htdocs/testsite7/index.php on line 173
Title: Re: Pasting HTML Article
Post by: tino on July 25, 2020, 08:46:59 PM
SMF 2.0?

That's an entity encoding error.
Title: Re: Pasting HTML Article
Post by: Lesmond on July 25, 2020, 09:03:22 PM
Quote from: tino on July 25, 2020, 08:46:59 PM
SMF 2.0?

That's an entity encoding error.

Sorry yes "SMF 2.1 RC2 TinyPortal 1.6.7"
Title: Re: Pasting HTML Article
Post by: lurkalot on July 25, 2020, 09:47:50 PM
Quote from: tino on July 25, 2020, 08:46:59 PM
SMF 2.0?

That's an entity encoding error.

I noticed if you try posting that same piece of text with the smiley in 1.6.7 running on 2.0.17 it strips the smiley out and saves fine, just without the smiley.
Title: Re: Pasting HTML Article
Post by: lurkalot on July 25, 2020, 09:58:57 PM
And although this topic title suggests this is an article issue the same error occurs if you past it in a html block. 
Title: Re: Pasting HTML Article
Post by: Lesmond on July 25, 2020, 10:00:34 PM
The item I posted in the article had this ....
(https://tinypix.top/images/2020/07/25/PjvSZ.png)

You can imagine how long it took me to remove all the smiles :(
Title: Re: Pasting HTML Article
Post by: Lesmond on July 25, 2020, 10:08:13 PM
Quote from: lurkalot on July 25, 2020, 09:58:57 PM
And although this topic title suggests this is an article issue the same error occurs if you past it in a html block. 
Actually I tried with a BBC article too, same result.
Title: Re: Pasting HTML Article
Post by: lurkalot on July 25, 2020, 10:08:41 PM
Quote from: Lesmond on July 25, 2020, 10:00:34 PM
The item I posted in the article had this ....
(https://tinypix.top/images/2020/07/25/PjvSZ.png)

You can imagine how long it took me to remove all the smiles :(

Where were you copying the text from Les?  Just wondering what generated those smiles
Title: Re: Pasting HTML Article
Post by: lurkalot on July 25, 2020, 10:17:33 PM
Quote my post or click to modify it, you'll see your smiley is showing while mine is just showing the code.  Hence why I'm wondering where those smileys came from.

Just testing this ?😎

And also this  8)
Title: Re: Pasting HTML Article
Post by: Lesmond on July 25, 2020, 10:27:18 PM
Quote from: lurkalot on July 25, 2020, 10:08:41 PM
Where were you copying the text from Les?  Just wondering what generated those smiles

Originally from facebook, I thought that may have been the problem, so I copied the text to notepad in plain text, the smiles were copied into notepad too.

But it seems that it happens even if you copy from here too, as your test confirmed.
Title: Re: Pasting HTML Article
Post by: lurkalot on July 25, 2020, 11:11:26 PM
Quote from: Lesmond on July 25, 2020, 10:27:18 PM
Quote from: lurkalot on July 25, 2020, 10:08:41 PM
Where were you copying the text from Les?  Just wondering what generated those smiles

Originally from facebook, I thought that may have been the problem, so I copied the text to notepad in plain text, the smiles were copied into notepad too.

But it seems that it happens even if you copy from here too, as your test confirmed.

Seems that TP doesn't like Emoji's 😲
Title: Re: Pasting HTML Article
Post by: tino on July 25, 2020, 11:18:06 PM
Quote from: tino on July 25, 2020, 08:46:59 PM
That's an entity encoding error.

mb_entity_encode and UTF-8 will probably fix it.
Title: Re: Pasting HTML Article
Post by: @rjen on July 26, 2020, 07:52:32 AM
Just to confirm: checked it with Tp 200 on SMF 2.0 and 2.1

On SMF 20 the text is parsed and saved (smiley is saved as multiple question marks?)

On SMF 21 the database error shows

So it is an issue that only occurs on SMF 2.1 with both TP 167 and 200
Title: Re: Pasting HTML Article
Post by: Lesmond on July 26, 2020, 09:56:38 AM
Just to point out, using an emoji from the editor works OK with no error, but copying one from elsewhere or using one from chromes built in emojis will give the error.

(https://tinypix.top/images/2020/07/26/PjpHF.png)


So to reiterate, if you copied this  :) you would not get an error.

If you copied this 😒 from chrome you would.
Title: Re: Pasting HTML Article
Post by: lurkalot on July 26, 2020, 11:47:26 AM
Quote from: tino on July 25, 2020, 11:18:06 PM
Quote from: tino on July 25, 2020, 08:46:59 PM
That's an entity encoding error.

mb_entity_encode and UTF-8 will probably fix it.

Hopefully Tino, thank you.  Think they addressed this at SMF 2.0.16, then done the same to 2.1 around the same time. 

Curious about the UTF-8 thing though, isn't 2.1 installed as UTF-8 by default, or do you mean something else?