could not encode content to iso-8859-1, I was facing this error while I am generating the QR code for the show personal details by scanning the QR. Therefor, the first, I was creating a vCard using the laravel package. you can see in the below function. After all the data appending in the card, that returned data I was adding in the QR code that time error show. but not able to find the solution. what is going wrong?
After a lot's practice, I found the solution, that I have given you below, utf8_decode() using this function I fix your error. I have also shown you how I was doing and to fix this issue what did.
SOLUTION
Using this function I fix my solution.
$iso88591_1 = utf8_decode($utf8);
HOW HAPPENED IN MY CASE ?
I was generating a QR code. in this QR code I was appending my card data by generating form the card.
use QrCode;
use Storage;
$vCardData = raf_create_vcard($data); // MY HELPER FUNCTION
$qr = QrCode::format('png')
->merge(asset('public/qr-logo.png'), 0.3, true)
->size(200)
->errorCorrection('H')
->generate($vCardData);
$name = time().'.png';
Storage::disk('public')->put($name,$qr);
Error :unable to connect to server connection to the server at port 5432 failed timeout expired
This is my function, my name was coming with multiple spaces between my first name and last name. using this function I remove all the extra space between that string and the QR code gets generated.
function raf_create_vcard($data,$type=false){
// define vcard
$vcard = new VCard();
// define variables
$additional = '';
$prefix = '';
$suffix = '';
// THIS PROBLE
// THIS CREATING PROBLEM WHEN I GENERATING THE QRCODE
$name = 'Haresh Chauhan'; // MY NAME COMING SOMETHING LIKE THIS
// SO THE QR NOT ACCEPTING THIS NAME WITH MULTIPLE SPACE
// THIS SOLUTION
// USING THIS utf8_decode() FUNCTION THE MULTI SPACE REMOVE
$name = utf8_decode('Haresh Chauhan');
// ADD PERSONAL DATA
$vcard->addName($name,'swapinfoway', $additional, $prefix, $suffix);
// ADD WORK DATA
$vcard->addCompany($data['business_unit_name']);
$vcard->addJobtitle(utf8_decode($data['designation_english']));
if ($type == true) {
$vcard->addPhoneNumber($data['mobile_no'], 'WORK');
}
$vcard->addPhoneNumber(businessAlias($data['business_unit_name'])->business_unit_tel, 'WORK');
$vcard->addEmail($data['email_id']);
$vcard->addURL('http://'.businessAlias($data['business_unit_name'])->business_unit_web);
// RETURN VCARD AS A STRING
return $vcard->getOutput();
}
Error : You need to install the imagick extension to use this back end
Laravel 6 validation with error message
Error : Trying To Get Property Of ID Non-Object All Possible Solution Guideline In Laravel - PHP
We always thanks to you for reading our blogs.
Dharmesh Chauhan
(Swapinfoway Founder)Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us
Haresh Chauhan
(Co-Founder)We Are Also Recommending You :
- Laravel Remove index.php From URL
- Laravel Zaakpay Payment Gateway Integration Tutorial Example
- How to connect database with php
- Pinelabs Payment Gateway Integration Tutorial In Laravel
- PhonePe Payment Gateway Integration in Laravel
- Get Zipcode/Pincode From Latitude and Longitude PHP and Google Maps API
- Laravel One to Many Eloquent Relationship Tutorial With Example
- Livewire File Upload Laravel
- Laravel 9 QR Code Generator Basic To Advanced Tutorial Example
- Laravel One to One Eloquent Relationship Tutorial