1

I got an error when i try to load a file image on my staging server, it seems is about encoding. When i access to the following URL:

http://example.com/sites/default/files/2016-12/Articulaci%C3%B3n.jpg

Apache throws a 404 (Not found) error, the file exists and has the name "Articulación.jpg"

But If i try to load the image file with the following URL works:

http://example.com/sites/default/files/2016-12/Articulacio%CC%81n.jpg

On my local server (development), both URLs works, i can see the image as expected.

My development server is an installation of MAMP:

  • MacOS Sierra 10.12.3
  • Drupal 8.2.1
  • PHP 5.5.14
  • Apache 2.2.26 (Unix)
  • PostgreSQL 9.4.4

My staging server is a Centos server:

  • Centos 7
  • Drupal 8.2.1
  • PHP 5.6.26
  • Apache 2.4.6 (CentOS)
  • PostgreSQL 9.2.15

I think this a kind a url mapping or encoding fallback behavior of apache, maybe a module, extension or server configuration is falling/missing on my staging server.

symcbean
  • 21,009
  • 1
  • 31
  • 52

1 Answers1

0

The URLs have two different UTF-8 encodings for ó character. The first one is %CC%81 and the second one is %C3%B3. You need to find out why the URL is different on each server, and make sure they are the same.

So, some setting in your development server causes it to encode the URL in a different way. This can be related to the PHP version difference or character set / encoding used in PHP.

Another possibility is that Mac OS is less strict with the filenames, and can match the same file with different encodings.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • I did try to change most staging server configuration variables (Apache and PHP) to meet my development server, but there are not results. maybe you know something else about "Another possibility is that Mac OS is less strict with the filenames, and can match the same file with different encodings."?, i think this the root issue – Sergio Meneses Mar 22 '17 at 00:20
  • Actually it is `o%CC%81` (not just `%CC%81`). That is UTF-8 for **o** followed by **COMBINING ACUTE ACCENT (U+0301)**. – kasperd Mar 26 '17 at 23:00