Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: keyboard on May 28, 2022, 08:43:52 AM

Title: Copy & Paste & character in file attachments titles problem
Post by: keyboard on May 28, 2022, 08:43:52 AM
Hi

Need advice again

When I copy & Paste a file name with "&" , I get some funny symbol !

I will rename a file and call it
Al Bano & Romina Power - Impossibile.mid


I will then attach the file and I get
Al Bano & Romina Power - Impossibile.mid

Please advise

Ron
Title: Re: Copy & Paste ?
Post by: Doug Heffernan on May 28, 2022, 09:18:08 AM
What is collation character set to for the database? If it is not already set to utf-8, you can convert it either through the forum 's Admin Panel->Maintenance->Database->Convert HTML-entities to UTF-8 characters, or through phpmyadmin. Have a look at my post below on how to do that.

https://www.simplemachines.org/community/index.php?topic=582171.msg4125320#msg4125320

Whatever method you choose, do not forget to make first a backup of your database prior to the utf-8 conversion.

Additionally you can have a look at this link as well and double check that the utf-8 conversion has been done properly/thoroughly.

https://wiki.simplemachines.org/smf/UTF-8_Readme

Hope it helps.
Title: Re: Copy & Paste ?
Post by: Arantor on May 28, 2022, 10:12:51 AM
Um... & is not a character that's up in the UTF-8 extended range, it's character 39, way down in the base set so it won't be UTF-8 encoding that's the problem.

More likely it's SMF over-escaping - because & has special meaning in HTML and routinely gets encoded internally as the amp; form shown. Could well be an SMF bug, there are a few lurking with attachments.
Title: Re: Copy & Paste ?
Post by: keyboard on May 28, 2022, 11:04:32 AM
Quote from: Arantor on May 28, 2022, 10:12:51 AMUm... & is not a character that's up in the UTF-8 extended range, it's character 39, way down in the base set so it won't be UTF-8 encoding that's the problem.

More likely it's SMF over-escaping - because & has special meaning in HTML and routinely gets encoded internally as the amp; form shown. Could well be an SMF bug, there are a few lurking with attachments.

Boy ! That is beyond my skill set to understand.   Hopefully there will be a solution.
Title: Re: Copy & Paste ?
Post by: Doug Heffernan on May 28, 2022, 11:16:01 AM
I misread your first post @keyboard, sorry about that. I thought that it was about text in posts and not attachments.

Did it happen out of nowhere or was it always like this?
Title: Re: Copy & Paste ?
Post by: keyboard on May 28, 2022, 11:35:57 AM
I just tried to upload a file at createsongstyles and it did the same thing

it's only on 2.1 not 2.0.*

You cannot view this attachment.
Title: Re: Copy & Paste ?
Post by: Doug Heffernan on May 28, 2022, 11:38:31 AM
I tried this on a brand new 2.1.2. forum and I could reproduce this as well. I have moved this topic to the Bug Reports forum and edited the title to reflect the issue, so our developers can take a look at it.
Title: Re: Copy & Paste & character in file attachments titles problem
Post by: keyboard on May 28, 2022, 11:39:35 AM
thanks Doug
Title: Re: Copy & Paste & character in file attachments titles problem
Post by: Doug Heffernan on May 28, 2022, 11:40:02 AM
Quote from: keyboard on May 28, 2022, 11:39:35 AMthanks Doug

No problem Ron.
Title: Re: Copy & Paste & character in file attachments titles problem
Post by: Kindred on May 28, 2022, 12:20:27 PM
Are & even valid characters in files names?

They should not be, if they are... lol
Title: Re: Copy & Paste & character in file attachments titles problem
Post by: Arantor on May 28, 2022, 12:55:19 PM
Quote from: Kindred on May 28, 2022, 12:20:27 PMAre & even valid characters in files names?

Yes, perfectly valid. Pretty much the kickers across the main operating systems are :, /, \, *, ?, ", | and NUL.

The non-printables are generally disliked too. There are a few specific restricted filenames on Windows that you can't have, e.g. you can't name something CON (because it's a reserved filename for the console), LPT1 (printer), COM1 (serial port) etc.

MacOS and Linux tend to be more open since they don't restrict the shell meta characters (because escape is normal there, unlike Windows where quoting is the usual practice without escaping)

The issue is SMF is over-encoding the filename.
Title: Re: Copy & Paste & character in file attachments titles problem
Post by: Steve on May 28, 2022, 04:12:49 PM
Flagging for @Sesquipedalian
Title: Re: Copy & Paste & character in file attachments titles problem
Post by: Max22 on November 27, 2022, 04:34:09 PM
Flagging for @shawnb61
https://github.com/SimpleMachines/SMF/issues/7494