As the title says, question marks are returned only when I run mysqld.exe
and httpd.exe
from within my java
program. However, when I run xampp.exe
and start apache
and mysql
from the UI it works perfectly. I am using slim 3 framework with mysql database.
I've tried setting character set in every possible way: setting the slim application configurations, setting the database character set, writing response
using JSON_UNESCAPED_UNICODE
, etc.
// Slim application configuration
$config = [ 'charset' => 'utf-8' .....]
// .htacess file
AddDefaultCharset utf-8
// my.ini was already configured
// $response in php function
return $response->withHeader('Content-Type', 'application/json')->withStatus(200)->withJson($json_response, null, JSON_UNESCAPED_UNICODE);
However, since the problem is being resolved when I manually run xampp I'm thinking maybe there is some file that should run alongside the ones mentioned above. If not, is there a way to work around this?
EDIT: I tried inserting data through the api instead of manually inserting it using a query in phpmyadmin
. This inserted data was the only line that returned correctly. Note that I inserted the data while the server was run from within my java
program.