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 :
- How To Clone Laravel
- Convert base64 String To Image And Upload In Laravel
- Default index.php Root Path Change And Remove Public From The Url
- How to Integrate Razorpay Payment Gateway in Laravel 9 Example
- How To Check Given URL Is Valid Or Not PHP Function Example
- How To Add Google reCAPTCHA v2 In HTML Form Based PHP/Laravel Website
- Adding Watermark On Image In PHP Example
- How To Configuration Laravel Supervisor
- PhonePe Payment Gateway Integration in Laravel
- How To Remove HTML Tags From The PHP String