0

I'm finding some older answers to this questions, but as I got this problem just now, I'm reposting as I assume there are different answers now.

I have a Mysql database (MariaDB) coded in latin1. After a server upgrade, som of my php scripts stopped working. I think at least php was updated in the process.

It appears that I'm having problems with character encoding.

1) I'm unable to insert string values in the database containing non-ascii characters such as æ, ø and å. The string values comes from the file_name of an upload file $_FILES('file').

2) Using phpMyAdmin (version 4.6.4 - latest Debian release) trying the query SELECT * FROM files WHERE filename = '%å%' returns no results, allthough there are several records having "å" in the filename. (Trying a similar query on an UTF8-encoded database uing phpMyAdmin, returns all rows!).

There are som older claims that PEAR DB does not support UTF8, only latin1. But this may not be true anymore. I've found there is a mysql_set_charset( 'UTF8') that should do the trick, but I want to stick to PEAR DB.

Any ideas?

user29809
  • 85
  • 7
  • It turns out that this is a Mac/Windows problem. It is working with filenames with æøå from my PC, but not from my Mac (and the server is Debian). And I was only testing on my Mac, and I will use my internal app mostly from my Mac. – user29809 Aug 13 '19 at 08:12

1 Answers1

0
SHOW CREATE TABLE   -- perhaps the charset change in the migration?
SHOW VARIABLES LIKE 'char%'   -- controls the _client_

etc. See "Best practice" in Trouble with UTF-8 characters; what I see is not what I stored

Rick James
  • 135,179
  • 13
  • 127
  • 222