News: Welcome to the TinyPortal Support site.

Login  |  Register
HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

June 24, 2019, 05:06:54 AM

Login with username, password and session length

Recent

Members
Stats
  • Total Posts: 188454
  • Total Topics: 20728
  • Online Today: 39
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 0
Guests: 16
Total: 16

Author Topic: Special characters in the article subject  (Read 5087 times)

0 Members and 1 Guest are viewing this topic.

Offline wildenborch

  • Support Team
  • *
  • Posts: 342
Special characters in the article subject
« on: October 16, 2018, 12:39:38 PM »
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?


Offline @rjen

  • Support Team
  • *
  • Posts: 1678
    • FJR-club Nederland
Re: Special characters in the article subject
« Reply #1 on: October 16, 2018, 01:07:33 PM »
mmm, is this new? It seems like something that was there in previous versions too...
Running TP1.6.3 on SMF2.0 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 RC2
Want to check what php version I am testing on? See: PHP Info

Offline wildenborch

  • Support Team
  • *
  • Posts: 342
Re: Special characters in the article subject
« Reply #2 on: October 16, 2018, 01:17:32 PM »
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

Offline tino

  • Developer
  • *
  • Posts: 1568
Re: Special characters in the article subject
« Reply #3 on: October 16, 2018, 01:18:33 PM »
You have to update your forum locale as well as the database if you switch to UTF8

Offline wildenborch

  • Support Team
  • *
  • Posts: 342
Re: Special characters in the article subject
« Reply #4 on: October 16, 2018, 01:21:42 PM »
What do you mean with locale?

Offline wildenborch

  • Support Team
  • *
  • Posts: 342
Re: Special characters in the article subject
« Reply #5 on: October 16, 2018, 01:33:05 PM »
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

Code: [Select]
<input style="width: 92%;" name="tp_article_subject" type="text" value="'. htmlentities($mg['subject'], ENT_QUOTES) .'">
with the old code
Code: [Select]
<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.

Offline tino

  • Developer
  • *
  • Posts: 1568
Re: Special characters in the article subject
« Reply #6 on: October 16, 2018, 02:22:06 PM »
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)

Offline wildenborch

  • Support Team
  • *
  • Posts: 342
Re: Special characters in the article subject
« Reply #7 on: October 16, 2018, 02: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.

Offline tino

  • Developer
  • *
  • Posts: 1568
Re: Special characters in the article subject
« Reply #8 on: October 16, 2018, 02:40:45 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.

Offline tino

  • Developer
  • *
  • Posts: 1568
Re: Special characters in the article subject
« Reply #9 on: October 16, 2018, 03:33:06 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;

Code: [Select]
un_htmlspecialchars($mg['subject'])

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