Please help. I get this error while executing Model::create($attributes)
My database encoding IS utf8mb4 and collation is utf8mb4_unicode_ci
I have tried many suggestions such as rerun migrations, set name utf8 etc. Browsed previously asked similar questions for good few days - Nothing helps.. Please suggest what am i missing?
I will break the process down:
- It is Laravel 5.8 project
- I am using barbushin/php-imap package to fetch emails and store them to database.
This is the code:
public static function read()
{
/**
* Fetch emails
*/
$mailbox = new \PhpImap\Mailbox(
'{'.config('imap.host').':'.config('imap.port').'/'.config('imap.protocol').'/'.config('imap.encryption').'/novalidate-cert}INBOX',
''.config('imap.username').'',
''.config('imap.password').'',
storage_path('app/public/helpdesk'));
$ids = $mailbox->searchMailbox('ALL');
if($ids) {
foreach ($ids as $id) {
$message = $mailbox->getMail($id);
$task = Task::create([
'uuid' => $uuid,
'subject' => $message->subject,
'description' => $message->textHtml,
'from_name' => $message->fromName,
'from_email' => $message->fromAddress,
'task_type' => $type,
'task_status' => $status,
'start_at' => Carbon::now(),
'due_at' => Carbon::now()->addDays(1),
]);
$mailbox->deleteMail($id);
}
}
}
I successfully fetch emails, however when they contain non utf caracters (Lithuanian) in my case - i get an error
SQLSTATE[HY000]: General error: 1366 Incorrect string value
I have tried all sorts of encoding functions to preprocess text, however all i get is ? sybmols instead of actual letters OR the error...
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2VS0gCi
via IFTTT
Aucun commentaire:
Enregistrer un commentaire