I have a REST API endpoint that lets you upload a file to the server. When I save a file that is named using the latin alphabet there is no issue. But when I try to save a file that has a japanese character, the file is saved and the filename in the server is okay but when I look into the database the filename is not right.
The result in my DB when saving the file:
But when I look at the server's shell the filename is correct:
I tried changing the database collation into:
utf8mb4_unicode_ci
utf8
utf8_general_ci
...but the issue still persists.
Update: This is my query to insert the data:
public function setFileQuery($param,$file){
$this->module_id = $param['moduleid'];
$this->file_name = $file['name'];
$this->file_size = $file['size'];
$q = "INSERT INTO data_file
(module_id,file_name,file_size,start_time,end_time,elapse_time,through_put)
VALUES
(?,?,?,?,?,?,?)";
$insertStmt = $this->conn->prepare($q);
$insertStmt->execute([
$this->module_id,
$this->file_name,
$this->file_size,
null,
null,
null,
null,
]);
Responses::http_ok();
}