News: TinyPortal Release Schedule. Please read this update for More Info.

Login  |  Register
* *
TinyPortal on Twitter
Welcome, Guest. Please login or register.
Did you miss your activation email?
January 22, 2019, 04:29:53 PM

Login with username, password and session length

Recent

Members
  • Total Members: 3735
  • Latest: xMaster
Stats
  • Total Posts: 187126
  • Total Topics: 20629
  • Online Today: 49
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 0
Guests: 20
Total: 20

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

0 Members and 1 Guest are viewing this topic.

Offline wildenborch

  • Support Team
  • *
  • Posts: 337
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: 1254
    • 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.1 on SMF2.0 at: www.fjr-club.nl

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

Offline wildenborch

  • Support Team
  • *
  • Posts: 337
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: 1401
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: 337
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: 337
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: 1401
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: 337
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: 1401
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: 1401
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.

Offline wildenborch

  • Support Team
  • *
  • Posts: 337
Re: Special characters in the article subject
« Reply #10 on: October 17, 2018, 06:14:29 AM »
Hi Tino,

This code is working for the special characters but the text after and including " is removed.

This is also happening with
Code: [Select]
html_entity_decode($mg['subject'], ENT_QUOTES, ISO-8859-15)
I also tried it with this code
Code: [Select]
un_htmlspecialchars($mg['subject'], ENT_QUOTES)But this does not solve the " problem.
« Last Edit: October 17, 2018, 07:17:02 AM by wildenborch »

Offline tino

  • Developer
  • *
  • Posts: 1401
Re: Special characters in the article subject
« Reply #11 on: October 17, 2018, 12:11:04 PM »
Hi Tino,

This code is working for the special characters but the text after and including " is removed.

This is also happening with
Code: [Select]
html_entity_decode($mg['subject'], ENT_QUOTES, ISO-8859-15)
I also tried it with this code
Code: [Select]
un_htmlspecialchars($mg['subject'], ENT_QUOTES)But this does not solve the " problem.

Thanks, I'll get this fixed for 1.6.1

Offline wildenborch

  • Support Team
  • *
  • Posts: 337
Re: Special characters in the article subject
« Reply #12 on: October 17, 2018, 03:22:31 PM »
Tino,

I think the problem was caused by a corrupt file because after I renamed the sources directory and copied the Sources directory from a fresh SMF + Tinyportal 1.60 install the problem is no longer there.

Please ignore the above.
The problem is still there.


« Last Edit: October 18, 2018, 02:27:17 AM by wildenborch »

Offline wildenborch

  • Support Team
  • *
  • Posts: 337
Re: Special characters in the article subject
« Reply #13 on: October 18, 2018, 05:54:47 AM »
Upon some further checking I noticed that on the website with this behaviour, the settings.php file does not have
Code: [Select]
$db_character_set = 'utf8';All other websites I have do have this code in the settings.php.

After adding this code in the settings.php file the special characters are accepted.

Hopefully this is tomorrow still the same and of not I will striketrough this above sentence as well :)
« Last Edit: October 18, 2018, 06:36:14 AM by wildenborch »