TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 11:48:00 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,106
  • Total Topics: 21,213
  • Online today: 358
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 79
  • Total: 79

Special characters in the article subject

Started by wildenborch, October 16, 2018, 07:39:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wildenborch

Hi, I just noticed on my brothers website that special characters like é è ö etc are saved correctly and can also been seen in the published article but when editing the saved article, the subject is completely empty.
When you save the article without changing the subject the subject will be empty.
The language settings on his site in English (not utf-8) and the database is Latin Swedish Ci

When I change the language to English UTF-8 and use these special characters and save the article the subject is visible when editing the article.

So I can simply solve this by changing the language to English UTF but then all old articles are showing strange charecters like Myl�ne Farmer's new album is called D�sob�issance.
Not only in the subject but also in the article body so this is not really an option.

Is another solution possible?


@rjen

mmm, is this new? It seems like something that was there in previous versions too...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

wildenborch

This also happened in previous versions.
I just checked it in 1.50!

I know, I should have posted this in the support section....
I have now moved this topic to support

tino

You have to update your forum locale as well as the database if you switch to UTF8

wildenborch


wildenborch

But isn't it strange that the subject is empty after saving the article?
Looks a bit like the problem I had with " " in the subject.
https://www.tinyportal.net/index.php?topic=36070.msg293069#msg293069

Tino, it looks like the change to accept "" has created this problem on my brothers website. I replaced

<input style="width: 92%;" name="tp_article_subject" type="text" value="'. htmlentities($mg['subject'], ENT_QUOTES) .'">

with the old code
<input style="width: 92%;" name="tp_article_subject" type="text" value="'. $mg['subject'] .'">

and now the special characters are accepted and after saving also visiable when editing the article.

Unfortunately, now the text between and after "" and is now removed.

tino

html_entity_decode might work better.

Try it with html_entity_decode($mg['subject'], ENT_QUOTES, ISO-8859-15)

Or if its UTF8 html_entity_decode($mg['subject'], ENT_QUOTES, UTF-8)

wildenborch

Thanks Tino,

html_entity_decode($mg['subject'], ENT_QUOTES, ISO-8859-15)

did the trick!

Is this something I should change after each update or is this something that will be included in future releases?
For now it's on my list for files to change after an update.

tino

Quote from: wildenborch on October 16, 2018, 09:30:03 PM
Thanks Tino,

html_entity_decode($mg['subject'], ENT_QUOTES, ISO-8859-15)

did the trick!

Is this something I should change after each update or is this something that will be included in future releases?
For now it's on my list for files to change after an update.

I'll work out a more generic function for it in the next release.

tino

Quote from: wildenborch on October 16, 2018, 09:30:03 PM
Thanks Tino,

html_entity_decode($mg['subject'], ENT_QUOTES, ISO-8859-15)

did the trick!

Is this something I should change after each update or is this something that will be included in future releases?
For now it's on my list for files to change after an update.

Can you also try with this;


un_htmlspecialchars($mg['subject'])


If we can use the built in SMF one then it makes it easier.