• Resolved Michael

    (@mkalina)


    Hi,

    I successfully imported a lot of files with this plugin (hooray!), but with filenames containing special characters – in my case, German umlauts like ?, ?, ü – I keep running into AJAX errors.

    Not only that, but even the file selection dialogue already shows “wrong” filenames (and, strangely enough, wrong referenc-links). One example:

    1. File on server: F?rberdistel_1.jpg
    2. File in Media Sync: F?rberdistel_1.jpg
    3. Link on file in Media Sync: /wp-content/uploads/2001/01/F%E4rberdistel_1.jpg

    Of course, this fails as the file does not exist. How can I fix that? Renaming is not really an option, as these are hundreds of files in hundreds of folders. – Hence my need for your plugin ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author erolsk8

    (@erolsk8)

    Hi @mkalina, this has been reported and I believe I fixed it (in 1.1.7).

    But I just tried it again in WordPress 5.8 and it worked fine:
    1. File on server: f5229-aa?-oo?-uu?-ss?-ss?-cc?-zz?.jpg
    2. File in Media Sync: f5229-aa?-oo?-uu?-ss?-ss?-cc?-zz?.jpg
    3. Link on file in Media Sync (after successful import): …/wp-content/uploads/2021/08/f5229-aa%CC%88-oo%CC%88-uu%CC%88-ss%C3%9F-ss%CC%8C-cc%CC%8C-zz%CC%8C.jpg

    And this is the new database record:

    
    +---+-----------+-------------------+-------------------+------------+---------------------------------+------------+-----------+--------------+-----------+-------------+---------------------------------------------+-------+------+-------------------+-------------------+---------------------+-----------+----------------------------------------------------------------------------------------+----------+----------+--------------+-------------+
    |ID |post_author|post_date          |post_date_gmt      |post_content|post_title                       |post_excerpt|post_status|comment_status|ping_status|post_password|post_name                                    |to_ping|pinged|post_modified      |post_modified_gmt  |post_content_filtered|post_parent|guid                                                                                    |menu_order|post_type |post_mime_type|comment_count|
    +---+-----------+-------------------+-------------------+------------+---------------------------------+------------+-----------+--------------+-----------+-------------+---------------------------------------------+-------+------+-------------------+-------------------+---------------------+-----------+----------------------------------------------------------------------------------------+----------+----------+--------------+-------------+
    |194|1          |2021-08-01 00:00:00|2021-08-01 00:00:00|            |f5229-aa?-oo?-uu?-ss?-ss?-cc?-zz?|            |inherit    |open          |closed     |             |f5229-aa%cc%88-oo%cc%88-uu%cc%88-sss-ss-cc-zz|       |      |2021-08-01 00:00:00|2021-08-01 00:00:00|                     |0          |https://media-sync.local/wp-content/uploads/2021/08/f5229-aa?-oo?-uu?-ss?-ss?-cc?-zz?.jpg|0         |attachment|image/jpeg    |0            |
    +---+-----------+-------------------+-------------------+------------+---------------------------------+------------+-----------+--------------+-----------+-------------+---------------------------------------------+-------+------+-------------------+-------------------+---------------------+-----------+----------------------------------------------------------------------------------------+----------+----------+--------------+-------------+
    

    Maybe the collation of your database table does not support special characters. Similar to this discussion:
    https://stackoverflow.com/questions/39818679/which-sql-collation-to-use-for-special-characters-such-as-%C3%A9
    or this:
    https://stackoverflow.com/questions/6115612/how-to-convert-an-entire-mysql-database-characterset-and-collation-to-utf-8

    My collation is: utf8mb4_unicode_520_ci.

    But if you’re unfamiliar with database stuff or don’t have access. You could just try to upload that file with special characters in WordPress Media Library and see what happens. I’m guessing something similar.

    Please let me know if you find out something new.

    Thanks

    Erol

    Thread Starter Michael

    (@mkalina)

    Hi Erol,

    thanks for the quick answer. (This is rare these days here on www.ads-software.com, so really: thank you!)

    I have just checked: utf8mb4_unicode_520_ci – so it’s exactly the same as your’s. And I have uploaded a file. This is how it looks like for me now:

    * post_title: Fa?rberdistel_3.jpg
    * post_name: fa%cc%88rberdistel_3.jpg
    * Link on file in media sync (after successful import): /wp-content/uploads/2021/08/Fa%CC%88rberdistel_3.jpg
    * Filename on server: Fa?rberdistel_3.jpg

    Then I did it the other way round. I uploaded the file into the media library and tried to catch it with media sync:

    * Filename on server: _Fa?rberdistel_MEDIASYNCTEST.jpg.
    * Display in media sync: _F?rberdistel_MEDIASYNCTEST.jpg.
    * Link in media sync: /wp-content/uploads/2021/08/_F%C3%A4rberdistel_MEDIASYNCTEST.jpg

    See the issue?

    Upload on server through media library: Fa%CC%88rberdistel
    Upload on server via FTP, then import through Media Sync: F%C3%A4rberdistel

    They are different; I expected them to be the same. I guess this is the issue that prevents importing?

    Thank you,
    Michael

    • This reply was modified 3 years, 3 months ago by Michael. Reason: Added question
    Plugin Author erolsk8

    (@erolsk8)

    That’s strange, I just tried to compare it with the letter “a?”, and it’s converted to “a%cc%88” and it’s the same from both Media Library or Media Sync plugin:

    
    +---+-----------+-------------------+-------------------+------------+----------------------+------------+-----------+--------------+-----------+-------------+-------------------------+-------+------+-------------------+-------------------+---------------------+-----------+---------------------------------------------------------------------------+----------+----------+--------------+-------------+
    |ID |post_author|post_date          |post_date_gmt      |post_content|post_title            |post_excerpt|post_status|comment_status|ping_status|post_password|post_name                |to_ping|pinged|post_modified      |post_modified_gmt  |post_content_filtered|post_parent|guid                                                                       |menu_order|post_type |post_mime_type|comment_count|
    +---+-----------+-------------------+-------------------+------------+----------------------+------------+-----------+--------------+-----------+-------------+-------------------------+-------+------+-------------------+-------------------+---------------------+-----------+---------------------------------------------------------------------------+----------+----------+--------------+-------------+
    |199|1          |2021-08-11 11:41:52|2021-08-11 11:41:52|            |a?---from-MediaSync   |            |inherit    |open          |closed     |             |a%cc%88-from-mediasync   |       |      |2021-08-11 11:41:52|2021-08-11 11:41:52|                     |0          |https://media-sync.local/wp-content/uploads/2021/08/a?---from-MediaSync.jpg |0         |attachment|image/jpeg    |0            |
    |197|1          |2021-08-11 11:39:04|2021-08-11 11:39:04|            |a?---from-MediaLibrary|            |inherit    |open          |closed     |             |a%cc%88-from-medialibrary|       |      |2021-08-11 11:39:04|2021-08-11 11:39:04|                     |0          |https://media-sync.local/wp-content/uploads/2021/08/a?-from-MediaLibrary.jpg|0         |attachment|image/jpeg    |0            |
    +---+-----------+-------------------+-------------------+------------+----------------------+------------+-----------+--------------+-----------+-------------+-------------------------+-------+------+-------------------+-------------------+---------------------+-----------+---------------------------------------------------------------------------+----------+----------+--------------+-------------+
    

    Also, I intentionally created a new database with invalid collation like this:

    
    ALTER DATABASE wp_media_sync_bad_collation CHARACTER SET latin2 COLLATE latin2_croatian_ci;
    ALTER TABLE wp_posts CONVERT TO CHARACTER SET latin2 COLLATE latin2_croatian_ci;
    ALTER TABLE wp_postmeta CONVERT TO CHARACTER SET latin2 COLLATE latin2_croatian_ci;
    

    And when trying to import into this database, I got this error:

    
    Attach ID not received for inserted attachment (<code>wp_posts</code> table) for file: /path/.../wp-content/uploads/2021/08/f5229-aa?-oo?-uu?-ss?-ss?-cc?-zz?-MORE-aa?-ii?.jpg.
    

    Because these new database tables simply do not allow saving some of those special characters.

    And now I really need to get back to work, so I’ll have to get back to this some other time. But please keep me updated if you figure out something.

    Plugin Author erolsk8

    (@erolsk8)

    And yes, collation of the whole table isn’t so important as the collation of these database tables: wp_posts and wp_postmeta.

    Thread Starter Michael

    (@mkalina)

    Kind of solved the issue. Downloaded the folder with all the unrecognized files. Simply uploaded it again. Now Media Sync encoded them correctly and was able to import them. Such a simple solution. It seems the problem is related to “unicode equivalence”. No idea, but for me it is solved for now.

    Plugin Author erolsk8

    (@erolsk8)

    Wow, that’s crazy ??

    This could be helpful for others with the same issue. So thanks for the update.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Filenames with diacritics not recognized’ is closed to new replies.